<div dir="ltr">Hi Walter,<div>thank you for the PEG version and attached tests.</div><div><br></div><div>It's a bit say saying hallo to you from the VO perspective.</div><div><br></div><div>Best wishes for your new job!</div><div><br></div><div>Marco</div><div><div class="gmail_extra"><br><div class="gmail_quote">2018-01-12 6:49 GMT+01:00 Walter Landry <span dir="ltr"><<a href="mailto:wlandry@caltech.edu" target="_blank">wlandry@caltech.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Everyone,<br>
<br>
There was interest in the past in a PEG version of the ADQL grammar.<br>
I am attaching a PEG version of ADQL 2.0 and two sets of tests. As<br>
discussed earlier, I had to make a number of modifications to the BNF<br>
to get an equivalent PEG grammar. My tests are extensive but not<br>
comprehensive. So I am somewhat confident, but not completely<br>
confident, that it parses everything according to the standard.<br>
<br>
To test it yourself, you can paste adql.peg into box 1 in<br>
<br>
<a href="https://pegjs.org/online" rel="noreferrer" target="_blank">https://pegjs.org/online</a><br>
<br>
and adql_tests_pass.sql into box 2. That will give you immediate<br>
feedback on whether the query parses.<br>
<br>
Normally, I would say that if you see any problems, please let me<br>
know. However, my last day at IRSA is today, after which I will be<br>
moving to a position as a Research Software Engineer in quantum field<br>
theory. If you need to contact me, my email address will not change.<br>
<br>
I have had a great time going to the IVOA meetings and seeing so many<br>
friendly, familiar faces. I wish you all the best in working out<br>
these standards.<br>
<br>
Cheers,<br>
Walter Landry<br>
<br>/// A PEG grammar suitable for directly putting into PEGjs.<br>
<br>
queries = (space* query space* ';')* space*<br>
<br>
unqualified_schema_name = identifier<br>
<br>
correlation_name = identifier<br>
correlation_specification = ("AS"i space)? space* correlation_name<br>
<br>
/// The spec says to have correlation_name as an alternate, but<br>
/// table_name matches everything that correlation name matches,<br>
/// so correlation_name will never match.<br>
qualifier = table_name<br>
<br>
/// I have to manually expand the possibilities in<br>
/// column_reference and table name, because a catalog.schema can<br>
/// match against schema.table or table.column, gobbling up the<br>
/// table or column name and making the parse fail.<br>
table_name =<br>
(catalog_name '.' unqualified_schema_name '.' identifier)<br>
/ (unqualified_schema_name '.' identifier)<br>
/ identifier<br>
<br>
column_reference =<br>
(catalog_name '.' unqualified_schema_name<br>
'.' identifier '.' identifier)<br>
/ (unqualified_schema_name '.' identifier '.' identifier)<br>
/ (identifier '.' identifier)<br>
/ identifier<br>
catalog_name = identifier<br>
<br>
/// This puts term and numeric_value_expression on the left, not<br>
/// right. Otherwise the rule greedily recurses on itself and<br>
/// runs out of stack space. With that reordering, the first term<br>
/// is always the same and the second part becomes optional.<br>
term = factor (space* ('*' / '/') space* term)?<br>
numeric_value_expression =<br>
term (space* ('+' / '-') space* numeric_value_expression)?<br>
<br>
string_value_function = string_geometry_function / user_defined_function<br>
<br>
string_geometry_function = extract_coordsys<br>
extract_coordsys = 'COORDSYS'i space* '(' space* geometry_value_expression space* ')'<br>
<br>
/// Flipped the order here because a value_expression_primary can<br>
/// match a function name that should be matched by<br>
/// string_value_function<br>
character_primary = string_value_function / value_expression_primary<br>
character_factor = character_primary<br>
concatenation_operator = '||'<br>
/// Flip the order of character_factor and<br>
/// character_value_expression to prevent recursion.<br>
character_value_expression = character_factor<br>
(space* concatenation_operator space* character_value_expression)?<br>
<br>
string_value_expression = character_value_expression<br>
<br>
concatenation_expression = character_factor space* concatenation_operator<br>
space* character_value_expression<br>
<br>
/// This expression first checks for a concatenation operator.<br>
/// Otherwise a numeric_value_expression would match the first<br>
/// half of a concatenation, meaning the concatenation operator<br>
/// would cause the parse to fail. We can not put<br>
/// string_value_expression first, because that would partially<br>
/// match arithmetic. For 'a+b', it matches 'a' but not the '+'.<br>
<br>
value_expression = concatenation_expression<br>
/ numeric_value_expression / string_value_expression / geometry_value_expression<br>
<br>
column_name = identifier<br>
<br>
as = value_expression space* ('AS'i space+)? column_name<br>
<br>
select_non_as_item = (qualifier '.*') / value_expression<br>
select_item = as / select_non_as_item<br>
select_list = select_item (space* ',' space* select_item)*<br>
<br>
columns = '*' / select_list<br>
set_function_type = 'AVG'i / 'MAX'i / 'MIN'i<br>
/ 'SUM'i / 'COUNT'i<br>
set_quantifier = ('DISTINCT'i / 'ALL'i)<br>
&space<br>
/// The '&nonidentifier_character' after set_function_type allows us<br>
/// to fail immediately if we get a set_function that does not have a<br>
/// parenthesis.<br>
general_set_function =<br>
set_function_type &nonidentifier_character<br>
space* '('<br>
(space* set_quantifier)?<br>
space* value_expression space* ')'<br>
<br>
set_function_specification<br>
= ('COUNT'i space* '(' space* '*' space* ')')<br>
/ general_set_function<br>
<br>
when_operand = value_expression<br>
result_expression = value_expression<br>
result = result_expression / 'NULL'i<br>
simple_when_clause = 'WHEN'i<br>
space+ when_operand<br>
space+ 'THEN'i<br>
space+ result<br>
else_clause = 'ELSE'i space+ result<br>
<br>
value_expression_primary =<br>
unsigned_value_specification<br>
/ column_reference<br>
/ set_function_specification<br>
/ ('(' value_expression ')')<br>
<br>
trig_function = (('ACOS'i<br>
/ 'ASIN'i<br>
/ 'ATAN'i<br>
/ 'COS'i<br>
/ 'COT'i<br>
/ 'SIN'i<br>
/ 'TAN'i)<br>
&nonidentifier_character)<br>
space* '('<br>
space* numeric_value_expression<br>
space* ')'<br>
/ ('ATAN2'i &nonidentifier_character space* '('<br>
space* numeric_value_expression space* ','<br>
space* numeric_value_expression space* ')')<br>
<br>
math_function = (('ABS'i<br>
/ 'CEILING'i<br>
/ 'DEGREES'i<br>
/ 'EXP'i<br>
/ 'FLOOR'i<br>
/ 'LOG10'i<br>
/ 'LOG'i<br>
/ 'RADIANS'i<br>
/ 'SQRT'i)<br>
&nonidentifier_character<br>
space* '('<br>
space* numeric_value_expression<br>
space* ')')<br>
/ (('MOD'i / 'POWER'i)<br>
&nonidentifier_character<br>
space* '('<br>
space* numeric_value_expression<br>
space* ','<br>
space* numeric_value_expression<br>
space* ')')<br>
/ ('PI'i &nonidentifier_character<br>
space* '(' space* ')')<br>
/ ('RAND'i &nonidentifier_character<br>
space* '(' numeric_value_expression? ')')<br>
/ (('ROUND'i / 'TRUNCATE'i) &nonidentifier_character<br>
space* '('<br>
space* numeric_value_expression<br>
(space* ',' space* signed_integer)?<br>
space* ')')<br>
<br>
/// default_function_prefix is a bit useless since it is optional.<br>
default_function_prefix = 'udf_'<br>
<br>
user_defined_function_name = default_function_prefix?<br>
regular_identifier<br>
<br>
user_defined_function_param = value_expression<br>
<br>
user_defined_function = user_defined_function_name<br>
space* '('<br>
(space* user_defined_function_param<br>
(space* ',' space* user_defined_function_param)*)<wbr>?<br>
space* ')'<br>
<br>
numeric_value_function = trig_function / math_function<br>
/ user_defined_function / numeric_geometry_function<br>
/// Flipped the order here, because a value_expression can match a<br>
/// function name.<br>
numeric_primary = numeric_value_function / value_expression_primary<br>
factor = sign? numeric_primary<br>
coord_sys = string_value_expression<br>
<br>
column_or_number = column_reference / double<br>
<br>
coordinates = numeric_value_expression space* ',' space* numeric_value_expression<br>
point = 'POINT'i<br>
space* '('<br>
space* coord_sys<br>
space* ','<br>
space* coordinates<br>
space* ')'<br>
point_or_column = point / column_reference<br>
<br>
circle = 'CIRCLE'i<br>
space* '(' space*<br>
coord_sys<br>
space* ','<br>
space* coordinates<br>
space* ','<br>
space* numeric_value_expression<br>
space* ')'<br>
box = 'BOX'i<br>
space* '('<br>
space* coord_sys<br>
space* ','<br>
space* coordinates<br>
space* ','<br>
space* numeric_value_expression<br>
space* ','<br>
space* numeric_value_expression<br>
space* ')'<br>
<br>
centroid = 'CENTROID'i space* '(' space* geometry_value_expression space* ')'<br>
region = 'REGION'i space* '(' space* string_value_expression space* ')'<br>
<br>
coord_list = coordinates (space* ',' space* coordinates)*<br>
polygon = 'POLYGON'i space*<br>
'(' space* coord_sys<br>
space* ','<br>
space* coord_list<br>
space* ')'<br>
<br>
geometry_value_expression = value_expression_primary / geometry_value_function<br>
geometry_value_function = point / circle / box / polygon / centroid / region<br>
<br>
area = 'AREA'i space* '(' space* geometry_value_expression space* ')'<br>
coord1 = 'COORD1'i space* '(' space* coord_value space* ')'<br>
coord2 = 'COORD2'i space* '(' space* coord_value space* ')'<br>
distance = 'DISTANCE'i space* '(' space* coord_value space* ',' space* coord_value space* ')'<br>
coord_value = point / column_reference<br>
<br>
non_predicate_geometry_<wbr>function = area / coord1 / coord2 / distance<br>
<br>
contains = 'CONTAINS'i<br>
space* '('<br>
space* geometry_value_expression<br>
space* ','<br>
space* geometry_value_expression<br>
space* ')'<br>
intersects = 'INTERSECTS'i<br>
space* '('<br>
space* geometry_value_expression<br>
space* ','<br>
space* geometry_value_expression space* ')'<br>
<br>
predicate_geometry_function = contains / intersects<br>
<br>
numeric_geometry_function = predicate_geometry_function / non_predicate_geometry_<wbr>function<br>
<br>
keyword = (ADQL_reserved_word / SQL_reserved_word) &(!identifier_character)<br>
<br>
simple_Latin_letter = [a-zA-Z]<br>
identifier_character = digit / simple_Latin_letter / '_'<br>
/// nonidentifier_character is to signal that, for example, in an<br>
/// AND, clause, AND is followed by something that is not an<br>
/// identifier (e.g. a space or parentheses).<br>
nonidentifier_character = &(!identifier_character) char<br>
all_identifiers = simple_Latin_letter identifier_character*<br>
regular_identifier = &(!keyword) all_identifiers<br>
<br>
nondoublequote_character = &(!'"') char<br>
delimited_identifier_part = nondoublequote_character / '""'<br>
delimited_identifier_body = delimited_identifier_part+<br>
delimited_identifier = '"' delimited_identifier_body '"'<br>
<br>
identifier = regular_identifier / delimited_identifier<br>
<br>
join_specification = join_condition / named_columns_join<br>
<br>
join_condition = 'ON'i space+ search_condition<br>
<br>
named_columns_join = 'USING'i space+ '('<br>
space* join_column_list space* ')'<br>
<br>
join_column_list = column_name_list<br>
<br>
column_name_list = column_name (space* ',' space* column_name)*<br>
<br>
table_correlation = table_name (space* correlation_specification)?<br>
<br>
/// Joins are a bit circuitous because of the possibility of<br>
/// parentheses, but I think this is the same as the BNF<br>
<br>
outer_join = ('LEFT'i / 'RIGHT'i / 'FULL'i) &space<br>
(space* 'OUTER'i &space)?<br>
<br>
join_type = 'INNER'i / outer_join<br>
<br>
join_suffix =<br>
('NATURAL'i space+)?<br>
(join_type space+)?<br>
'JOIN'i space+<br>
table_reference (space* join_specification)?<br>
<br>
qualified_join = (('(' space* joined_table space* ')')<br>
/ table_correlation)<br>
(space* join_suffix)+<br>
<br>
joined_table = qualified_join / ('(' space* joined_table space* ')')<br>
<br>
digit = [0-9]<br>
unsigned_integer = digit+<br>
exact_numeric_literal = (unsigned_integer ('.' unsigned_integer)?)<br>
/ ('.' unsigned_integer)<br>
<br>
sign = '+' / '-'<br>
signed_integer = sign? unsigned_integer<br>
mantissa = exact_numeric_literal<br>
exponent = signed_integer<br>
approximate_numeric_literal = mantissa ('E' / 'e') exponent<br>
unsigned_numeric_literal = approximate_numeric_literal / exact_numeric_literal<br>
<br>
double = sign? unsigned_numeric_literal<br>
<br>
quote = '\''<br>
literal_space = ' '<br>
newline = '\n'<br>
tab = '\t'<br>
minus_sign = '-'<br>
char = .<br>
<br>
nonquote_character = &(!quote) char<br>
character_representation = nonquote_character / '\'\''<br>
<br>
comment_introducer = minus_sign minus_sign+<br>
comment_character = &(!newline) char<br>
comment = comment_introducer comment_character* newline<br>
<br>
separator = comment / literal_space / newline<br>
space = separator<br>
<br>
/// String literals are implicitly concatenated when placed next to each other<br>
character_string_literal= quote character_representation* quote<br>
(separator+ quote character_representation* quote)*<br>
<br>
general_literal = character_string_literal<br>
unsigned_literal = unsigned_numeric_literal / general_literal<br>
unsigned_value_specification = unsigned_literal<br>
derived_correlation = subquery space* correlation_specification<br>
<br>
table_reference = joined_table / table_correlation / derived_correlation<br>
<br>
from_clause = 'FROM'i space+<br>
table_reference (space* ',' space* table_reference)*<br>
<br>
comparison_predicate = value_expression<br>
space* ('=' / '!=' / '<>' / '<=' / '>=' / '<' / '>')<br>
space* value_expression<br>
<br>
between_predicate = value_expression &space<br>
(space* 'NOT'i &space)?<br>
space* 'BETWEEN'i &space<br>
space* value_expression &space<br>
space* 'AND'i &space<br>
space* value_expression<br>
<br>
in_predicate = value_expression &space<br>
(space* 'NOT'i &space)?<br>
space* 'IN'i &space<br>
space* (subquery<br>
/ ('(' space* (value_expression (space* ',' space* value_expression)*)<br>
space* ')'))<br>
<br>
null_predicate = value_expression<br>
space* ('IS'i &space)<br>
(space* 'NOT'i &space)?<br>
space* 'NULL'i<br>
<br>
match_value = character_value_expression<br>
pattern = character_value_expression<br>
<br>
like_predicate = match_value<br>
(space* 'NOT'i &space)?<br>
space* 'LIKE'i space+ pattern<br>
<br>
exists_predicate= 'EXISTS'i space+ subquery<br>
<br>
predicate = comparison_predicate / between_predicate / in_predicate<br>
/ null_predicate / like_predicate / exists_predicate<br>
<br>
where = 'WHERE'i space+ search_condition<br>
<br>
grouping_column_reference = column_reference<br>
grouping_column_reference_list = grouping_column_reference<br>
(space* ',' space* column_reference)*<br>
group_by_clause = 'GROUP'i &space<br>
space* 'BY'i &space<br>
space* grouping_column_reference_list<br>
<br>
having_clause = 'HAVING'i &space<br>
space* search_condition<br>
<br>
sort_key = column_name / unsigned_integer<br>
ordering_specification = 'ASC'i / 'DESC'i<br>
/// I have the vague feeling that there are cases where there are<br>
/// no spaces between the sort_key and ordering_specification, but<br>
/// I can not think of any.<br>
sort_specification = sort_key (space+ ordering_specification)?<br>
sort_specification_list = sort_specification<br>
(space* ',' space* sort_specification)*<br>
order_by_clause = 'ORDER'i &space<br>
space* 'BY'i &space<br>
space* sort_specification_list<br>
<br>
query = 'SELECT'i<br>
(space+ set_quantifier)?<br>
(space+ 'TOP'i space+ unsigned_integer)?<br>
space+ columns<br>
space+ from_clause<br>
(space+ where)?<br>
(space+ group_by_clause)?<br>
(space+ having_clause)?<br>
(space+ order_by_clause)?<br>
<br>
subquery = '(' space* (query / joined_table) space* ')'<br>
<br>
/// Reverse sort to avoid early matches.<br>
ADQL_reserved_word = 'TRUNCATE'i / 'TOP'i<br>
/ 'SQRT'i / 'SIN'i<br>
/ 'ROUND'i / 'REGION'i<br>
/ 'RAND'i / 'RADIANS'i<br>
/ 'POWER'i / 'POLYGON'i<br>
/ 'POINT'i / 'PI'i<br>
/ 'MOD'i / 'LOG10'i<br>
/ 'LOG'i / 'INTERSECTS'i<br>
/ 'FLOOR'i / 'EXP'i<br>
/ 'DISTANCE'i<br>
/ 'DEGREES'i / 'COS'i<br>
/ 'COORDSYS'i / 'COORD2'i<br>
/ 'COORD1'i / 'CONTAINS'i<br>
/ 'CIRCLE'i / 'CENTROID'i<br>
/ 'CEILING'i / 'BOX'i<br>
/ 'ATAN2'i / 'ATAN'i<br>
/ 'ASIN'i / 'AREA'i<br>
/ 'ACOS'i / 'ABS'i<br>
<br>
/// Split up SQL_reserved_word to help memory usage and compile times.<br>
SQL_reserved_word_00 = 'ZONE'i / 'YEAR'i<br>
/ 'WRITE'i / 'WORK'i<br>
/ 'WITH'i / 'WHERE'i<br>
/ 'WHENEVER'i / 'WHEN'i<br>
/ 'VIEW'i / 'VARYING'i<br>
/ 'VARCHAR'i<br>
/ 'VALUES'i / 'VALUE'i<br>
/ 'USING'i / 'USER'i<br>
/ 'USAGE'i<br>
<br>
SQL_reserved_word_01<br>
= 'UPPER'i / 'UPDATE'i<br>
/ 'UNKNOWN'i / 'UNIQUE'i<br>
/ 'UNION'i / 'TRUE'i<br>
/ 'TRIM'i / 'TRANSLATION'i<br>
/ 'TRANSLATE'i / 'TRANSACTION'i<br>
/ 'TRAILING'i / 'TO'i<br>
/ 'TIMEZONE_MINUTE'i / 'TIMEZONE_HOUR'i<br>
/ 'TIMESTAMP'i<br>
<br>
SQL_reserved_word_02<br>
= 'TIME'i / 'THEN'i<br>
/ 'TEMPORARY'i / 'TABLE'i<br>
/ 'SYSTEM_USER'i / 'SUM'i<br>
/ 'SUBSTRING'i / 'SQLSTATE'i<br>
/ 'SQLERROR'i / 'SQLCODE'i<br>
/ 'SQL'i / 'SPACE'i<br>
/ 'SOME'i / 'SMALLINT'i<br>
/ 'SIZE'i / 'SET'i<br>
<br>
SQL_reserved_word_03<br>
= 'SESSION_USER'i / 'SESSION'i<br>
/ 'SELECT'i / 'SECTION'i<br>
/ 'SECOND'i / 'SCROLL'i<br>
/ 'SCHEMA'i / 'ROWS'i<br>
/ 'ROLLBACK'i / 'RIGHT'i<br>
/ 'REVOKE'i / 'RESTRICT'i<br>
/ 'RELATIVE'i / 'REFERENCES'i<br>
/ 'REAL'i / 'READ'i<br>
<br>
SQL_reserved_word_10<br>
= 'PUBLIC'i / 'PROCEDURE'i<br>
/ 'PRIVILEGES'i / 'PRIOR'i<br>
/ 'PRIMARY'i / 'PRESERVE'i<br>
/ 'PREPARE'i / 'PRECISION'i<br>
/ 'POSITION'i / 'PARTIAL'i<br>
/ 'PAD'i / 'OVERLAPS'i<br>
/ 'OUTPUT'i / 'OUTER'i<br>
/ 'ORDER'i / 'OR'i<br>
<br>
SQL_reserved_word_11<br>
= 'OPTION'i / 'OPEN'i<br>
/ 'ONLY'i / 'ON'i / 'OF'i<br>
/ 'OCTET_LENGTH'i / 'NUMERIC'i<br>
/ 'NULLIF'i / 'NULL'i<br>
/ 'NOT'i / 'NO'i<br>
/ 'NEXT'i / 'NCHAR'i<br>
/ 'NATURAL'i / 'NATIONAL'i<br>
<br>
SQL_reserved_word_12 = 'NAMES'i / 'MONTH'i<br>
/ 'MODULE'i / 'MINUTE'i<br>
/ 'MIN'i / 'MAX'i<br>
/ 'MATCH'i / 'LOWER'i<br>
/ 'LOCAL'i / 'LIKE'i<br>
/ 'LEVEL'i / 'LEFT'i<br>
/ 'LEADING'i / 'LAST'i<br>
/ 'LANGUAGE'i / 'KEY'i<br>
<br>
SQL_reserved_word_13<br>
= 'JOIN'i / 'ISOLATION'i<br>
/ 'IS'i / 'INTO'i<br>
/ 'INTERVAL'i / 'INTERSECT'i<br>
/ 'INTEGER'i / 'INT'i<br>
/ 'INSERT'i / 'INSENSITIVE'i<br>
/ 'INPUT'i / 'INNER'i<br>
/ 'INITIALLY'i / 'INDICATOR'i<br>
/ 'IN'i / 'IMMEDIATE'i<br>
<br>
SQL_reserved_word_20 = 'IDENTITY'i / 'HOUR'i<br>
/ 'HAVING'i / 'GROUP'i<br>
/ 'GRANT'i / 'GOTO'i<br>
/ 'GO'i / 'GLOBAL'i<br>
/ 'GET'i / 'FULL'i<br>
/ 'FROM'i / 'FOUND'i<br>
/ 'FOREIGN'i / 'FOR'i<br>
/ 'FLOAT'i / 'FIRST'i<br>
<br>
SQL_reserved_word_21<br>
= 'FETCH'i / 'FALSE'i<br>
/ 'EXTRACT'i / 'EXTERNAL'i<br>
/ 'EXISTS'i / 'EXECUTE'i<br>
/ 'EXEC'i / 'EXCEPTION'i<br>
/ 'EXCEPT'i / 'ESCAPE'i<br>
/ 'END-EXEC'i / 'END'i<br>
/ 'ELSE'i / 'DROP'i<br>
/ 'DOUBLE'i / 'DOMAIN'i<br>
<br>
SQL_reserved_word_22<br>
= 'DISTINCT'i / 'DISCONNECT'i<br>
/ 'DIAGNOSTICS'i / 'DESCRIPTOR'i<br>
/ 'DESCRIBE'i / 'DESC'i<br>
/ 'DELETE'i / 'DEFERRED'i<br>
/ 'DEFERRABLE'i / 'DEFAULT'i<br>
/ 'DECLARE'i / 'DECIMAL'i<br>
/ 'DEALLOCATE'i / 'DAY'i<br>
/ 'DATE'i / 'CURSOR'i<br>
<br>
SQL_reserved_word_23<br>
= 'CURRENT_USER'i / 'CURRENT_TIMESTAMP'i<br>
/ 'CURRENT_TIME'i / 'CURRENT_DATE'i<br>
/ 'CURRENT'i / 'CROSS'i<br>
/ 'CREATE'i / 'COUNT'i<br>
/ 'CORRESPONDING'i / 'CONVERT'i<br>
/ 'CONTINUE'i / 'CONSTRAINTS'i<br>
/ 'CONSTRAINT'i / 'CONNECTION'i<br>
/ 'CONNECT'i / 'COMMIT'i<br>
<br>
SQL_reserved_word_30<br>
= 'COLUMN'i / 'COLLATION'i<br>
/ 'COLLATE'i / 'COALESCE'i<br>
/ 'CLOSE'i / 'CHECK'i<br>
/ 'CHAR_LENGTH'i / 'CHARACTER_LENGTH'i<br>
/ 'CHARACTER'i / 'CHAR'i<br>
/ 'CATALOG'i / 'CAST'i<br>
/ 'CASE'i / 'CASCADED'i<br>
/ 'CASCADE'i / 'BY'i<br>
<br>
SQL_reserved_word_31 = 'BOTH'i / 'BIT_LENGTH'i<br>
/ 'BIT'i / 'BETWEEN'i<br>
/ 'BEGIN'i / 'AVG'i<br>
/ 'AUTHORIZATION'i<br>
/ 'AT'i / 'ASSERTION'i<br>
/ 'ASC'i / 'AS'i<br>
/ 'ARE'i / 'ANY'i<br>
/ 'AND'i / 'ALTER'i<br>
/ 'ALLOCATE'i<br>
<br>
SQL_reserved_word_32 = 'ALL'i / 'ADD'i<br>
/ 'ACTION'i<br>
/ 'ABSOLUTE'i<br>
<br>
SQL_reserved_word_0 = SQL_reserved_word_00 / SQL_reserved_word_01<br>
/ SQL_reserved_word_02 / SQL_reserved_word_03<br>
<br>
SQL_reserved_word_1 = SQL_reserved_word_10 / SQL_reserved_word_11<br>
/ SQL_reserved_word_12 / SQL_reserved_word_13<br>
<br>
SQL_reserved_word_2 = SQL_reserved_word_20 / SQL_reserved_word_21<br>
/ SQL_reserved_word_22 / SQL_reserved_word_23<br>
<br>
SQL_reserved_word_3 = SQL_reserved_word_30 / SQL_reserved_word_31<br>
/ SQL_reserved_word_32<br>
<br>
SQL_reserved_word = SQL_reserved_word_0 / SQL_reserved_word_1<br>
/ SQL_reserved_word_2 / SQL_reserved_word_3<br>
<br>
boolean_literal = 'True'i / 'False'i<br>
<br>
boolean_value_expression = boolean_literal / user_defined_function<br>
<br>
boolean_primary = predicate<br>
/ ('(' space* search_condition space* ')')<br>
/ boolean_value_expression<br>
<br>
boolean_factor = ('NOT'i &space)? space* boolean_primary<br>
<br>
boolean_term = boolean_factor<br>
space+ ('AND'i / 'OR'i)<br>
space+ search_condition<br>
<br>
search_condition = boolean_term / boolean_factor<br>
<br>Select ra1,dec2,flux From mytable Where Contains(Point('j2000',ra,dec)<wbr>,Circle('J2000',+10 , -20,-1))= 1;<br>
Select ra1,dec2,flux From mytable Where 1=Contains(Point('j2000',ra,<wbr>dec),Circle('J2000',+10 , -20,-1));<br>
Select ra1,dec2,flux From mytable Where 1=Contains(pos,Circle('J2000',<wbr>+10 , -20,-1));<br>
Select ra1,dec2,flux From mytable Where Intersects(pos,Circle('J2000',<wbr>+10 , -20,-1))= 1;<br>
Select ra1,dec2,flux From mytable Where 1=INTERSECTs(pos,Circle('<wbr>J2000',+10 , -20,-1));<br>
Select ra1,dec2,flux From mytable Where Contains(Point('galactic',ra,<wbr>dec),Circle('galactic',+10 , -20,-1))= 1;<br>
Select ra1,dec2,flux From mytable Where Contains(Point('ICRS',ra,dec),<wbr>Circle('icrs',+10 , -20,-1))= 1;<br>
SELECT ra1 As rara, dec2, flux FROM mytable WHERE CONTAINS(POINT('J2000 Geocenter',ra,dec),CIRCLE('<wbr>J2000 Geocenter',+10 , -20,-1))= 1;<br>
SELECT ra1 As rara, dec2, flux FROM mytable WHERE CONTAINS(POINT('J2000 Geocenter',ra,dec),BOX('J2000'<wbr>,+10 , -20,1,2))= 1;<br>
SELECT ra1 As rara, dec2, flux FROM mytable WHERE CONTAINS(POINT('J2000 Geocenter',ra,dec),POLYGON('<wbr>J2000',0,1,2,3,4,5,6,7,8,9,10,<wbr>11,12,13))= 1;<br>
SELECT * FROM mytable WHERE CONTAINS(POINT('J2000',<wbr>mytable.ra,dec),CIRCLE('J2000'<wbr>,+10 , -20,-1)) = 1;<br>
SELECT * FROM my_table WHERE 1=CONTAINS(POINT('J2000',ra,<wbr>my_table.dec),CIRCLE('J2000',+<wbr>10 , -20,-1));<br>
SELECT * FROM my_table1 WHERE 1= CONTAINS(POINT('J2000',my_<wbr>table1.ra,dec),CIRCLE('J2000',<wbr>+10 , -20,-1));<br>
SELECT * FROM my_table1 WHERE 1= CONTAINS(POINT('J2000',my_<wbr>table1.ra,dec),CIRCLE('J2000',<wbr>+10 , -20,-1)) And (x<1);<br>
SELECT * FROM my_table1 WHERE (x!=3) and 1= CONTAINS(POINT('J2000',my_<wbr>table1.ra,dec),CIRCLE('J2000',<wbr>+10 , -20,-1));<br>
SELECT * FROM my_table1 WHERE x!=3;<br>
SELECT * FROM my_table1;<br>
SELECT * FROM my_table1 where x>2;<br>
SELECT * FROM my_table1 where x>2 AND x<4;<br>
SELECT * FROM my_table1 WHERE 1= CONTAINS(POINT('J2000',my_<wbr>table1.ra,dec),CIRCLE('J2000',<wbr>+10 , -20,-1)) And (x<1 And x>2 Or y < 3 Or y >5);<br>
SELECT * FROM my_table1 WHERE 1= CONTAINS(POINT('J2000',my_<wbr>table1.ra,dec),CIRCLE('J2000',<wbr>+10 , -20,-1)) And (x<1 And x>2);<br>
SELECT * FROM my_table1 where (x>2 AND x<4) Or (x>6 and x<10);<br>
SELECT * FROM my_table1 where (x Between 2 AND 4) Or (x>6 and x<10);<br>
SELECT * FROM my_table1 where x is null;<br>
SELECT * FROM my_table1 where x is not null;<br>
SELECT * FROM fp_psc WHERE CONTAINS(POINT('J2000',ccc.fp_<wbr>psc.ra, aaa.ccc.fp_pscdec),CIRCLE('<wbr>J2000',1,1,0.08))=1 and (ra between 0.95 and 1.05);<br>
SELECT * FROM my_table1 where x in (select y from my_table2);<br>
SELECT * FROM my_table1 where x in (10,20,30);<br>
SELECT * FROM my_table1 where x not in (10,20,30);<br>
SELECT All * FROM my_table1;<br>
SELECT Distinct * FROM my_table1;<br>
SELECT Top 14223 * FROM my_table1;<br>
SELECT * FROM my_table1 where 38*(x+1-3)>2/4;<br>
SELECT ra+dec as ra_dec FROM my_table1;<br>
SELECT ra+dec FROM my_table1;<br>
SELECT my_tablel1.* FROM my_table1;<br>
SELECT sin(dec),cos(dec),tan(dec),<wbr>cot(dec),asin(dec),acos(dec),<wbr>atan(dec),atan2(ra,dec) FROM my_table1;<br>
SELECT abs(ra),ceiling(ra), degrees(ra),exp(ra),floor(ra),<wbr>log(ra),log10(ra),radians(ra),<wbr>sqrt(ra) FROM my_table1;<br>
SELECT mod(ra, dec),power( ra,dec ),pi(),rand(ra),rand(),round(<wbr>ra,10),round(ra),truncate(ra),<wbr>truncate(ra,10) FROM my_table1;<br>
SELECT modern() FROM my_table1;<br>
SELECT my_modern_function(ra,dec) FROM my_table1;<br>
SELECT my_modern_function(ra,dec), modern() FROM my_table1;<br>
SELECT my_modern_function(ra,dec) || modern() FROM my_table1;<br>
select 'a b c','a','a ''bv' from b;<br>
select "a b","a "" b" from b;<br>
select 'a' 'b' from b;<br>
select 'a' --This is a useful comment<br>
'b' from b;<br>
select (a), sum(a), max(all a), min(distinct a), count(a), avg ( a ) ,min(a) from a;<br>
select max(all a) from a;<br>
select count ( * ) from a;<br>
select count(*) from a;<br>
select count(a) from a;<br>
select count(all a) from a;<br>
select count(distinct a) from a;<br>
select sum(a) from a;<br>
select sum(all a) from a;<br>
select sum(DISTINCT a) from a;<br>
select sum(DISTINCTa) from a;<br>
select single from a;<br>
select a,b from a group by a;<br>
select a,b from a group by a having x>2;<br>
SELECT * FROM my_table1 order by x;<br>
SELECT * FROM my_table1 order by x asc;<br>
SELECT * FROM my_table1 order by x desc;<br>
select b from a where x<1 order by a;<br>
SELECT * FROM my_table1 where x like y;<br>
SELECT * FROM my_table1 where x like y || z;<br>
SELECT * FROM my_table1 where x not like my_sin(x);<br>
SELECT * FROM my_table1 where x like my_sin(x) || x;<br>
SELECT * FROM my_table1 where exists (select a from b);<br>
SELECT * FROM my_table WHERE (mjd>=55550.0 and mjd<=65650.5);<br>
SELECT my_table1.*,'table' from my_table1;<br>
SELECT myschema.mytable.* from myschema.mytable;<br>
SELECT * from mycatalog.myschema.mytable;<br>
SELECT * from myschema.mytable;<br>
SELECT mycatalog.myschema.mytable.* from mycatalog.myschema.mytable;<br>
SELECT * from myschema.mytable as mine;<br>
SELECT * from myschema.mytable mine;<br>
SELECT * from myschema.mytable, yourscheme.yourtable mine;<br>
SELECT * from TAP_UPLOAD.mytable;<br>
SELECT * from tapmod.mytable;<br>
SELECT TAP_UPLOAD.mytable.b from TAP_UPLOAD.mytable;<br>
SELECT TAP_UPLOAD.mytable.* from TAP_UPLOAD.mytable;<br>
SELECT TAP_UPLOAD.mytable.*, fp_psc.* from TAP_UPLOAD.mytable, fp_psc;<br>
SELECT * FROM my_table1 WHERE 1= CONTAINS(POINT('J2000',TAP_<wbr>UPLOAD.mytable.ra,TAP_UPLOAD.<wbr>mytable.dec),CIRCLE('J2000',+<wbr>10 , -20,-1)) ;<br>
SELECT * FROM my_table1 WHERE 1= CONTAINS(POINT('J2000',TAP_<wbr>UPLOAD.mytable.ra,TAP_UPLOAD.<wbr>mytable.dec),CIRCLE('J2000',<wbr>TAP_UPLOAD.mytable.ra,TAP_<wbr>UPLOAD.mytable.dec,-1)) ;<br>
SELECT alligator from a;<br>
SELECT tophat from a;<br>
SELECT max(alligator) from a;<br>
SELECT maximus from a;<br>
SELECT ast from a;<br>
Select fromage from fromming;<br>
Select fromage from fromming ast;<br>
select alligator from table1 join table2;<br>
select alligator from table1 natural join table2;<br>
select alligator from table1 natural left outer join table2;<br>
select alligator from table1 right outer join table2;<br>
select alligator from table1 right join table2;<br>
select alligator from table1 full outer join table2;<br>
select alligator from table1 natural inner join table2;<br>
select alligator from table1 inner join table2;<br>
select alligator from (table1 join table2);<br>
select alligator from table1 join (table2 join (table3 join table4));<br>
select alligator from table1 join table2 on a=b;<br>
select alligator from table1 t1 join table2 t2 on a=b join table3 t3 on c=d join table4 t4 on e=f join table5 t5 on g=h;<br>
select alligator from (table1 t1 join table2 t2 on a=b) join table3 t3 on c=d;<br>
select alligator from table1 join table2 using (a,b, c );<br>
select TOP 14223 caom.observation.*,caom.plane.<wbr>*,caom.artifact.*,caom.part.*,<wbr>caom.chunk.* FROM caom.observation join caom.plane on caom.observation.obsid = caom.plane.obsid join caom.artifact on caom.plane.planeid = caom.artifact.planeid join caom.part on caom.artifact.artifactid = caom.part.artifactid join caom.chunk on caom.part.partid = caom.chunk.partid;<br>
select TOP 14223 caom.observation.*,caom.plane.<wbr>*,caom.artifact.*,caom.part.*,<wbr>caom.chunk.* FROM (((caom.observation join caom.plane on caom.observation.obsid = caom.plane.obsid) join caom.artifact on caom.plane.planeid = caom.artifact.planeid) join caom.part on caom.artifact.artifactid = caom.part.artifactid) join caom.chunk on caom.part.partid = caom.chunk.partid;<br>
select alligator from (select a from b) as c;<br>
select fp_psc.* from fp_psc, TAP_UPLOAD.mytable where 1=contains(fp_psc.ra_dec, circle('j2000',TAP_UPLOAD.<wbr>mytable.ra,TAP_UPLOAD.mytable.<wbr>dec,0.001));<br>
select fp_psc.* from fp_psc, TAP_UPLOAD.mytable where 1=contains(fp_psc.ra_dec, circle('j2000',TAP_UPLOAD.<wbr>mytable.ra,TAP_UPLOAD.mytable.<wbr>dec,TAP_UPLOAD.mytable.r));<br>
select fp_psc.* from fp_psc, TAP_UPLOAD.mytable where 1=contains(fp_psc.ra_dec, circle('j2000',10,TAP_UPLOAD.<wbr>mytable.dec,TAP_UPLOAD.<wbr>mytable.r));<br>
select fp_psc.* from fp_psc, TAP_UPLOAD.mytable where 1=contains(fp_psc.ra_dec, circle('j2000',TAP_UPLOAD.<wbr>mytable.ra,10,TAP_UPLOAD.<wbr>mytable.r));<br>
select (fp_psc.x * TAP_UPLOAD.mytable.x) as dx from fp_psc, TAP_UPLOAD.mytable;<br>
select (TAP_UPLOAD.mytable.x - fp_psc.x) as dx from TAP_UPLOAD.mytable, fp_psc;<br>
select TAP_UPLOAD.mytable.x - TAP_UPLOAD.mytable.y as dx from TAP_UPLOAD.mytable, fp_psc;<br>
select (fp_psc.x - fp_psc.y) + (TAP_UPLOAD.mytable.x - fp_psc.x) as dxy from fp_psc;<br>
select fp_psc.x - TAP_UPLOAD.mytable.x from fp_psc, TAP_UPLOAD.mytable;<br>
select TAP_UPLOAD.mytable.x - fp_psc.x from fp_psc, TAP_UPLOAD.mytable;<br>
select * from herschel.observations where ST_Covers(poly,ST_Point(10,10)<wbr>)='t' or ST_Distance(poly,ST_Point(10,<wbr>10)) <= 0.0;<br>
select herschel.observations.*, ST_Distance(ST_Centroid(poly),<wbr>ST_Point(84.912154,-69.652608)<wbr>) as dist_to_centroid from herschel.observations where ST_Covers(poly,ST_Point(10,10)<wbr>)='t' or ST_Distance(poly,ST_Point(10,<wbr>10)) <= 0.0;<br>
select * from a where (1=0) AND (2=1) ORDER BY cntr ASC;<br>
select '{a,b}' from c;<br>
select ARRAYNOT from c;<br>
select * from twomass.full_images where (ST_DWithin(twomass.full_<wbr>images.poly,ST_Point(1, 1),0*111194.68229846345,'f'));<br>
SELECT schema_name as schemas FROM (select schema_name, min(table_index) as schema_index from TAP_SCHEMA.tables group by schema_name order by schema_index) as temp_schemas group by schemas order by schema_index;<br>
select schema_name from (select schema_name, min(table_index) as schema_index from TAP_SCHEMA.tables group by schema_name order by schema_index) temp_schemas;<br>
SELECT TAP_UPLOAD.pos.cntr as in_row_id FROM wise.wise_allwise_p3am_cdd, TAP_UPLOAD.pos WHERE (ST_Intersects(TAP_UPLOAD.pos.<wbr>poly,wise.wise_allwise_p3am_<wbr>cdd.poly)) ORDER BY in_row_id ASC, dist_to_bounds ASC;<br>
select CASEFULL from b;<br>
<br>
<br>
POINT('foo',10 20);<br>
POINT('foo',1.0, 20);<br>
POINT('foo',10 ,-2.0);<br>
SELECTTOP 100 * FROM my_table1;<br>
SELECT TOP100 * FROM my_table1;<br>
SELECT TOP 100* FROM my_table1;<br>
SELECT TOP hundred * FROM my_table1;<br>
SELECT DISTINCT sin FROM my_table1;<br>
SELECT TOP 100 FROM my_table1;<br>
SELECT * FROM my_table1 where x in(10,20,30);<br>
SELECT * FROM my_table1 where x not in(10,20,30);<br>
SELECT FROM my_table1 WHERE CONTAINS(POINT('J2000',10 , 20),CIRCLE('J2000',10 , 20,1));<br>
SELECT * FROM WHERE CONTAINS(POINT('J2000',10 , 20),CIRCLE('J2000',10 , 20,1));<br>
1= CONTAINS(POINT('J2000',my_<wbr>table1.ra,dec),CIRCLE('J2000',<wbr>+10 , -20,-1)) And x<1 And x>2 Or y < 3 Or y >5SELECT *,ra FROM my_table1;<br>
SELECT my_tablel1.* as ra_dec FROM my_table1;<br>
select sum(a,b) from a;<br>
select sum from a;<br>
select sum( from a;<br>
select abs(a,b) from a;<br>
select sin from a;<br>
select sin() from a;<br>
select sin( from a;<br>
select atan2 from a;<br>
select atan2() from a;<br>
select atan2(a) from a;<br>
select atan2(a,) from a;<br>
select atan2(a,b from a;<br>
select round from a;<br>
select round() from a;<br>
select round(a,) from a;<br>
select round(a,b from a;<br>
select round(a,10 from a;<br>
select count(* from a;<br>
select b from a where x<1 groupby a;<br>
select b from a where x<1 group bya;<br>
select b from a where x<1 orderby a;<br>
select b from a where x<1 order bya;<br>
select b from a where x<1 havinga;<br>
select a asb from a group by a;<br>
Select fromage ast from fromming;<br>
SELECT * FROM my_table1 where (x notBetween 2 AND 4);<br>
SELECT * FROM my_table1 where x notin (10,20,30);<br>
SELECT * FROM mytable WHERECONTAINS(POINT('J2000',<wbr>mytable.ra,dec),CIRCLE('J2000'<wbr>,+10 , -20,-1)) = 1;<br>
SELECT * FROM mytable as my WHERECONTAINS(POINT('J2000',<wbr>mytable.ra,dec),CIRCLE('J2000'<wbr>,+10 , -20,-1)) = 1;<br>
SELECT * from TAP_UPLOAD.wrong_table;<br>
SELECT TAP_UPLOAD.* from TAP_UPLOAD.mytable;<br>
SELECT TAP_UPLOAD.wrong_table from TAP_UPLOAD.mytable;<br>
select CASE foo WHENever THEN 'c' END from b;<br>
select alligator from (table1);<br>
<br>POINT('foo',10 20);<br>
POINT('foo',1.0, 20);<br>
POINT('foo',10 ,-2.0);<br>
SELECTTOP 100 * FROM my_table1;<br>
SELECT TOP100 * FROM my_table1;<br>
SELECT TOP 100* FROM my_table1;<br>
SELECT TOP hundred * FROM my_table1;<br>
SELECT DISTINCT sin FROM my_table1;<br>
SELECT TOP 100 FROM my_table1;<br>
SELECT * FROM my_table1 where x in(10,20,30);<br>
SELECT * FROM my_table1 where x not in(10,20,30);<br>
SELECT FROM my_table1 WHERE CONTAINS(POINT('J2000',10 , 20),CIRCLE('J2000',10 , 20,1));<br>
SELECT * FROM WHERE CONTAINS(POINT('J2000',10 , 20),CIRCLE('J2000',10 , 20,1));<br>
1= CONTAINS(POINT('J2000',my_<wbr>table1.ra,dec),CIRCLE('J2000',<wbr>+10 , -20,-1)) And x<1 And x>2 Or y < 3 Or y >5SELECT *,ra FROM my_table1;<br>
SELECT my_tablel1.* as ra_dec FROM my_table1;<br>
select sum(a,b) from a;<br>
select sum from a;<br>
select sum( from a;<br>
select abs(a,b) from a;<br>
select sin from a;<br>
select sin() from a;<br>
select sin( from a;<br>
select atan2 from a;<br>
select atan2() from a;<br>
select atan2(a) from a;<br>
select atan2(a,) from a;<br>
select atan2(a,b from a;<br>
select round from a;<br>
select round() from a;<br>
select round(a,) from a;<br>
select round(a,b from a;<br>
select round(a,10 from a;<br>
select count(* from a;<br>
select b from a where x<1 groupby a;<br>
select b from a where x<1 group bya;<br>
select b from a where x<1 orderby a;<br>
select b from a where x<1 order bya;<br>
select b from a where x<1 havinga;<br>
select a asb from a group by a;<br>
Select fromage ast from fromming;<br>
SELECT * FROM my_table1 where (x notBetween 2 AND 4);<br>
SELECT * FROM my_table1 where x notin (10,20,30);<br>
SELECT * FROM mytable WHERECONTAINS(POINT('J2000',<wbr>mytable.ra,dec),CIRCLE('J2000'<wbr>,+10 , -20,-1)) = 1;<br>
SELECT * FROM mytable as my WHERECONTAINS(POINT('J2000',<wbr>mytable.ra,dec),CIRCLE('J2000'<wbr>,+10 , -20,-1)) = 1;<br>
SELECT * from TAP_UPLOAD.wrong_table;<br>
SELECT TAP_UPLOAD.* from TAP_UPLOAD.mytable;<br>
SELECT TAP_UPLOAD.wrong_table from TAP_UPLOAD.mytable;<br>
select CASE foo WHENever THEN 'c' END from b;<br>
select alligator from (table1);<br>
<br></blockquote></div><br></div></div></div>