From a38e021eb02e606f1dff08201d04e5217db106d1 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Mon, 9 Jun 2025 09:35:20 -0400 Subject: [PATCH] parser: parse more of returning, json_objectagg, json_arrayagg, xmlforest Also handle postfix json operators, i.e. `select x is not json array` Reworked `::` cast parsing for it to be less custom / hacked in --- .../src/generated/syntax_kind.rs | 11 + crates/squawk_parser/src/grammar.rs | 275 +++- crates/squawk_parser/src/lib.rs | 179 ++- .../tests/data/regression_suite/errors.sql | 240 ++-- .../tests/data/regression_suite/returning.sql | 10 +- .../data/regression_suite/transactions.sql | 136 +- .../tests/snapshots/tests__delete_ok.snap | 123 +- .../tests/snapshots/tests__explain_ok.snap | 22 +- .../tests/snapshots/tests__insert_ok.snap | 20 +- .../tests/snapshots/tests__merge_pg17_ok.snap | 118 +- .../tests/snapshots/tests__misc_ok.snap | 233 ++- .../snapshots/tests__regression_errors.snap | 287 +--- .../tests__regression_returning.snap | 231 +-- .../snapshots/tests__regression_rules.snap | 27 +- .../snapshots/tests__regression_sqljson.snap | 1069 +------------- .../tests__regression_sqljson_queryfuncs.snap | 52 +- .../tests__regression_suite_errors.snap | 10 +- .../tests__regression_transactions.snap | 115 +- .../tests__regression_tuplesort.snap | 182 --- .../snapshots/tests__regression_xml.snap | 14 - .../snapshots/tests__select_casts_ok.snap | 1272 +++++++++-------- ...ests__select_compound_union_select_ok.snap | 32 +- .../snapshots/tests__select_funcs_ok.snap | 13 +- .../tests__select_funcs_pg17_ok.snap | 11 +- .../snapshots/tests__select_operators_ok.snap | 429 +++--- .../tests/snapshots/tests__update_ok.snap | 68 +- .../tests/snapshots/tests__values_ok.snap | 11 +- .../squawk_syntax/src/ast/generated/nodes.rs | 495 +++++++ crates/squawk_syntax/src/postgresql.ungram | 229 +-- 29 files changed, 2411 insertions(+), 3503 deletions(-) diff --git a/crates/squawk_parser/src/generated/syntax_kind.rs b/crates/squawk_parser/src/generated/syntax_kind.rs index 88c5d80d..a7ad1ee9 100644 --- a/crates/squawk_parser/src/generated/syntax_kind.rs +++ b/crates/squawk_parser/src/generated/syntax_kind.rs @@ -780,9 +780,19 @@ pub enum SyntaxKind { INTERVAL_TYPE, INTO_CLAUSE, IS_DISTINCT_FROM, + IS_JSON, + IS_JSON_ARRAY, + IS_JSON_OBJECT, + IS_JSON_SCALAR, + IS_JSON_VALUE, IS_NORMALIZED, IS_NOT, IS_NOT_DISTINCT_FROM, + IS_NOT_JSON, + IS_NOT_JSON_ARRAY, + IS_NOT_JSON_OBJECT, + IS_NOT_JSON_SCALAR, + IS_NOT_JSON_VALUE, IS_NOT_NORMALIZED, JOIN, JSON_BEHAVIOR_CLAUSE, @@ -886,6 +896,7 @@ pub enum SyntaxKind { RESET_STORAGE_PARAMS, RESTART, RESTRICT, + RETURNING_CLAUSE, RETURN_FUNC_OPTION, RET_TYPE, REVOKE, diff --git a/crates/squawk_parser/src/grammar.rs b/crates/squawk_parser/src/grammar.rs index 57c99510..01525b08 100644 --- a/crates/squawk_parser/src/grammar.rs +++ b/crates/squawk_parser/src/grammar.rs @@ -438,7 +438,7 @@ fn opt_json_null_clause(p: &mut Parser<'_>) { // | WITHOUT UNIQUE KEYS // | WITHOUT UNIQUE // | /* EMPTY */ -fn opt_json_key_unique_constraint(p: &mut Parser<'_>) { +pub(crate) fn opt_json_keys_unique_clause(p: &mut Parser<'_>) { if p.at(WITH_KW) || p.at(WITHOUT_KW) { let m = p.start(); p.bump_any(); @@ -512,7 +512,7 @@ fn json_object_fn_arg_list(p: &mut Parser<'_>) { } } opt_json_null_clause(p); - opt_json_key_unique_constraint(p); + opt_json_keys_unique_clause(p); opt_json_returning_clause(p); } @@ -523,6 +523,18 @@ fn json_object_fn(p: &mut Parser<'_>) -> CompletedMarker { }) } +fn json_objectagg_fn(p: &mut Parser<'_>) -> CompletedMarker { + assert!(p.at(JSON_OBJECTAGG_KW)); + custom_fn(p, JSON_OBJECTAGG_KW, |p| { + if json_object_arg(p).is_none() { + p.error("expected expression"); + } + opt_json_null_clause(p); + opt_json_keys_unique_clause(p); + opt_json_returning_clause(p); + }) +} + /// fn json_table_fn(p: &mut Parser<'_>) -> CompletedMarker { custom_fn(p, JSON_TABLE_KW, |p| { @@ -542,9 +554,12 @@ fn custom_fn( name_ref.complete(p, NAME_REF); let args = p.start(); p.expect(L_PAREN); - body(p); + if !p.at(R_PAREN) { + body(p); + } p.expect(R_PAREN); args.complete(p, ARG_LIST); + opt_agg_clauses(p); m.complete(p, CALL_EXPR) } @@ -720,10 +735,6 @@ fn json_table_column(p: &mut Parser<'_>) { // [ RETURNING data_type [ FORMAT JSON [ ENCODING UTF8 ] ] ] // ) fn json_array_fn_arg_list(p: &mut Parser<'_>) { - // () - if p.at(R_PAREN) { - return; - } // 1, 2, 3, 4 while !p.at(EOF) && !p.at(R_PAREN) && !p.at(RETURNING_KW) { if p.at_ts(SELECT_FIRST) { @@ -806,6 +817,8 @@ fn atom_expr(p: &mut Parser<'_>) -> Option { (JSON_EXISTS_KW, L_PAREN) => json_exists_fn(p), (JSON_ARRAY_KW, L_PAREN) => json_array_fn(p), (JSON_OBJECT_KW, L_PAREN) => json_object_fn(p), + (JSON_OBJECTAGG_KW, L_PAREN) => json_objectagg_fn(p), + (JSON_ARRAYAGG_KW, L_PAREN) => json_arrayagg_fn(p), (JSON_QUERY_KW, L_PAREN) => json_query_fn(p), (JSON_SERIALIZE_KW, L_PAREN) => json_serialize_fn(p), (JSON_VALUE_KW, L_PAREN) => json_value_fn(p), @@ -817,6 +830,7 @@ fn atom_expr(p: &mut Parser<'_>) -> Option { (XMLROOT_KW, L_PAREN) => xmlroot_fn(p), (XMLSERIALIZE_KW, L_PAREN) => xmlserialize_fn(p), (XMLELEMENT_KW, L_PAREN) => xmlelement_fn(p), + (XMLFOREST_KW, L_PAREN) => xmlforest_fn(p), (XMLEXISTS_KW, L_PAREN) => xmlexists_fn(p), (XMLPARSE_KW, L_PAREN) => xmlparse_fn(p), (XMLPI_KW, L_PAREN) => xmlpi_fn(p), @@ -842,6 +856,19 @@ fn atom_expr(p: &mut Parser<'_>) -> Option { Some(done) } +fn json_arrayagg_fn(p: &mut Parser<'_>) -> CompletedMarker { + assert!(p.at(JSON_ARRAYAGG_KW)); + custom_fn(p, JSON_ARRAYAGG_KW, |p| { + if expr(p).is_none() { + p.error("expected expression"); + } + opt_json_format_clause(p); + opt_order_by_clause(p); + opt_json_null_clause(p); + opt_json_returning_clause(p); + }) +} + fn exists_fn(p: &mut Parser<'_>) -> CompletedMarker { assert!(p.at(EXISTS_KW)); custom_fn(p, EXISTS_KW, |p| { @@ -950,17 +977,7 @@ fn xmlelement_fn(p: &mut Parser<'_>) -> CompletedMarker { if p.eat(COMMA) { if p.eat(XMLATTRIBUTES_KW) { p.expect(L_PAREN); - while !p.at(EOF) && !p.at(R_PAREN) { - if expr(p).is_none() { - p.error("expected expression"); - } - if p.eat(AS_KW) { - col_label(p); - } - if !p.eat(COMMA) { - break; - } - } + xml_attribute_list(p); p.expect(R_PAREN); if p.eat(COMMA) && !expr_list(p) { p.error("expected expression list"); @@ -972,6 +989,27 @@ fn xmlelement_fn(p: &mut Parser<'_>) -> CompletedMarker { }) } +fn xml_attribute_list(p: &mut Parser<'_>) { + while !p.at(EOF) && !p.at(R_PAREN) { + if expr(p).is_none() { + p.error("expected expression"); + } + if p.eat(AS_KW) { + col_label(p); + } + if !p.eat(COMMA) { + break; + } + } +} + +fn xmlforest_fn(p: &mut Parser<'_>) -> CompletedMarker { + assert!(p.at(XMLFOREST_KW)); + custom_fn(p, XMLFOREST_KW, |p| { + xml_attribute_list(p); + }) +} + // XMLSERIALIZE '(' document_or_content a_expr AS SimpleTypename xml_indent_option ')' // xml_indent_option: // | INDENT @@ -1040,7 +1078,7 @@ fn json_fn(p: &mut Parser<'_>) -> CompletedMarker { p.error("expected expression"); } opt_json_format_clause(p); - opt_json_key_unique_constraint(p); + opt_json_keys_unique_clause(p); }) } @@ -1130,11 +1168,10 @@ fn opt_json_behavior_clause(p: &mut Parser<'_>) -> Option { p.expect(ON_KW); if !p.eat(ERROR_KW) { p.expect(EMPTY_KW); - if !opt_json_behavior(p) { - p.error("expected json behavior"); + if opt_json_behavior(p) { + p.expect(ON_KW); + p.expect(ERROR_KW); } - p.expect(ON_KW); - p.expect(ERROR_KW); } Some(m.complete(p, JSON_BEHAVIOR_CLAUSE)) } else { @@ -1333,6 +1370,66 @@ fn postfix_expr( lhs = m.complete(p, POSTFIX_EXPR); break; } + IS_KW if p.at(IS_NOT_JSON_OBJECT) => { + let m = lhs.precede(p); + p.bump(IS_NOT_JSON_OBJECT); + lhs = m.complete(p, POSTFIX_EXPR); + break; + } + IS_KW if p.at(IS_NOT_JSON_ARRAY) => { + let m = lhs.precede(p); + p.bump(IS_NOT_JSON_ARRAY); + lhs = m.complete(p, POSTFIX_EXPR); + break; + } + IS_KW if p.at(IS_NOT_JSON_VALUE) => { + let m = lhs.precede(p); + p.bump(IS_NOT_JSON_VALUE); + lhs = m.complete(p, POSTFIX_EXPR); + break; + } + IS_KW if p.at(IS_NOT_JSON_SCALAR) => { + let m = lhs.precede(p); + p.bump(IS_NOT_JSON_SCALAR); + lhs = m.complete(p, POSTFIX_EXPR); + break; + } + IS_KW if p.at(IS_NOT_JSON) => { + let m = lhs.precede(p); + p.bump(IS_NOT_JSON); + lhs = m.complete(p, POSTFIX_EXPR); + break; + } + IS_KW if p.at(IS_JSON_OBJECT) => { + let m = lhs.precede(p); + p.bump(IS_JSON_OBJECT); + lhs = m.complete(p, POSTFIX_EXPR); + break; + } + IS_KW if p.at(IS_JSON_ARRAY) => { + let m = lhs.precede(p); + p.bump(IS_JSON_ARRAY); + lhs = m.complete(p, POSTFIX_EXPR); + break; + } + IS_KW if p.at(IS_JSON_VALUE) => { + let m = lhs.precede(p); + p.bump(IS_JSON_VALUE); + lhs = m.complete(p, POSTFIX_EXPR); + break; + } + IS_KW if p.at(IS_JSON_SCALAR) => { + let m = lhs.precede(p); + p.bump(IS_JSON_SCALAR); + lhs = m.complete(p, POSTFIX_EXPR); + break; + } + IS_KW if p.at(IS_JSON) => { + let m = lhs.precede(p); + p.bump(IS_JSON); + lhs = m.complete(p, POSTFIX_EXPR); + break; + } NOTNULL_KW => { let m = lhs.precede(p); p.bump(NOTNULL_KW); @@ -1685,28 +1782,6 @@ fn json_key_value(p: &mut Parser<'_>, lhs: CompletedMarker) -> CompletedMarker { m.complete(p, JSON_KEY_VALUE) } -fn named_arg(p: &mut Parser<'_>, lhs: CompletedMarker) -> CompletedMarker { - assert!(p.at(FAT_ARROW) || p.at(COLON_EQ)); - let m = lhs.precede(p); - if p.at(COLON_EQ) { - p.bump(COLON_EQ); - } else { - p.bump(FAT_ARROW); - } - if expr(p).is_none() { - p.error("expected expr"); - } - m.complete(p, NAMED_ARG) -} - -fn cast_expr(p: &mut Parser<'_>, lhs: CompletedMarker) -> CompletedMarker { - assert!(p.at(COLON_COLON)); - let m = lhs.precede(p); - p.bump(COLON_COLON); - type_name(p); - m.complete(p, CAST_EXPR) -} - fn arg_expr(p: &mut Parser<'_>) -> Option { // https://www.postgresql.org/docs/17/typeconv-func.html p.eat(VARIADIC_KW); @@ -1901,6 +1976,16 @@ fn call_expr_args(p: &mut Parser<'_>, lhs: CompletedMarker) -> CompletedMarker { assert!(p.at(L_PAREN)); let m = lhs.precede(p); arg_list(p); + opt_agg_clauses(p); + let cm = m.complete(p, CALL_EXPR); + if opt_string_literal(p).is_some() { + cm.precede(p).complete(p, CAST_EXPR) + } else { + cm + } +} + +fn opt_agg_clauses(p: &mut Parser<'_>) { // postgres has: // func_expr: func_application within_group_clause filter_clause over_clause if p.at(WITHIN_KW) { @@ -1936,12 +2021,6 @@ fn call_expr_args(p: &mut Parser<'_>, lhs: CompletedMarker) -> CompletedMarker { } m.complete(p, OVER_CLAUSE); } - let cm = m.complete(p, CALL_EXPR); - if opt_string_literal(p).is_some() { - cm.precede(p).complete(p, CAST_EXPR) - } else { - cm - } } // foo[] @@ -2143,6 +2222,26 @@ fn current_op(p: &Parser<'_>, r: &Restrictions) -> (u8, SyntaxKind, Associativit IS_KW if !r.is_disabled && p.at(IS_DISTINCT_FROM) => (4, IS_DISTINCT_FROM, Left), // is not distinct from IS_KW if !r.is_disabled && p.at(IS_NOT_DISTINCT_FROM) => (4, IS_NOT_DISTINCT_FROM, Left), + // is not json + IS_KW if !r.is_disabled && p.at(IS_NOT_JSON) => NOT_AN_OP, + // is not json object + IS_KW if !r.is_disabled && p.at(IS_NOT_JSON_OBJECT) => NOT_AN_OP, + // is not json array + IS_KW if !r.is_disabled && p.at(IS_NOT_JSON_ARRAY) => NOT_AN_OP, + // is not json value + IS_KW if !r.is_disabled && p.at(IS_NOT_JSON_VALUE) => NOT_AN_OP, + // is not json scalar + IS_KW if !r.is_disabled && p.at(IS_NOT_JSON_SCALAR) => NOT_AN_OP, + // is json object + IS_KW if !r.is_disabled && p.at(IS_JSON_OBJECT) => NOT_AN_OP, + // is json array + IS_KW if !r.is_disabled && p.at(IS_JSON_ARRAY) => NOT_AN_OP, + // is json value + IS_KW if !r.is_disabled && p.at(IS_JSON_VALUE) => NOT_AN_OP, + // is json scalar + IS_KW if !r.is_disabled && p.at(IS_JSON_SCALAR) => NOT_AN_OP, + // is json + IS_KW if !r.is_disabled && p.at(IS_JSON) => NOT_AN_OP, // at time zone AT_KW if p.at(AT_TIME_ZONE) => (11, AT_TIME_ZONE, Left), // similar to @@ -2241,14 +2340,7 @@ fn expr_bp(p: &mut Parser<'_>, bp: u8, r: &Restrictions) -> Option { - lhs = cast_expr(p, lhs); - continue; - } - FAT_ARROW | COLON_EQ => { - lhs = named_arg(p, lhs); - continue; - } + // TODO: is this right? COLON | VALUE_KW => { lhs = json_key_value(p, lhs); continue; @@ -2262,7 +2354,16 @@ fn expr_bp(p: &mut Parser<'_>, bp: u8, r: &Restrictions) -> Option op_bp, }; let _ = expr_bp(p, op_bp, r); - lhs = m.complete(p, BIN_EXPR); + lhs = m.complete( + p, + if op == SyntaxKind::COLON_COLON { + CAST_EXPR + } else if matches!(op, FAT_ARROW | COLON_EQ) { + NAMED_ARG + } else { + BIN_EXPR + }, + ); } Some(lhs) } @@ -4365,8 +4466,22 @@ const EXPR_FIRST: TokenSet = LHS_FIRST; const ATTRIBUTE_FIRST: TokenSet = TokenSet::new(&[POUND, GROUP_KW]); const TARGET_FOLLOW: TokenSet = TokenSet::new(&[ - SELECT_KW, FROM_KW, WHERE_KW, LIMIT_KW, ORDER_KW, OFFSET_KW, GROUP_KW, INTO_KW, HAVING_KW, - WINDOW_KW, HAVING_KW, FETCH_KW, FOR_KW, R_PAREN, R_BRACK, + SELECT_KW, + FROM_KW, + WHERE_KW, + LIMIT_KW, + ORDER_KW, + OFFSET_KW, + GROUP_KW, + INTO_KW, + HAVING_KW, + WINDOW_KW, + HAVING_KW, + FETCH_KW, + FOR_KW, + R_PAREN, + R_BRACK, + RETURNING_KW, ]) .union(COMPOUND_SELECT_FIRST); @@ -4848,9 +4963,7 @@ fn begin(p: &mut Parser<'_>) -> CompletedMarker { // Sconst fn opt_string_literal(p: &mut Parser<'_>) -> Option { if p.at_ts(STRING_FIRST) { - let m = p.start(); - p.bump_any(); - Some(m.complete(p, LITERAL)) + literal(p) } else { None } @@ -12138,22 +12251,32 @@ fn opt_where_current_of(p: &mut Parser<'_>) { } fn opt_returning_clause(p: &mut Parser<'_>) { - if p.eat(RETURNING_KW) { - while !p.at(EOF) { - if !p.eat(STAR) { - if expr(p).is_none() { - p.error("expected output expression"); - } else { - opt_alias(p); - } - } - if !p.eat(COMMA) { - break; + if p.at(RETURNING_KW) { + let m = p.start(); + p.bump(RETURNING_KW); + if p.eat(WITH_KW) { + p.expect(L_PAREN); + returning_option(p); + while !p.at(EOF) && p.eat(COMMA) { + returning_option(p); } + p.expect(R_PAREN); } + if opt_target_list(p).is_none() { + p.error("expected target"); + } + m.complete(p, RETURNING_CLAUSE); } } +fn returning_option(p: &mut Parser<'_>) { + if !p.eat(OLD_KW) && !p.eat(NEW_KW) { + p.error("expected OLD or NEW"); + } + p.expect(AS_KW); + name(p); +} + // DROP TYPE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ] // https://www.postgresql.org/docs/17/sql-droptype.html fn drop_type(p: &mut Parser<'_>) -> CompletedMarker { diff --git a/crates/squawk_parser/src/lib.rs b/crates/squawk_parser/src/lib.rs index 6b73b764..26049995 100644 --- a/crates/squawk_parser/src/lib.rs +++ b/crates/squawk_parser/src/lib.rs @@ -189,8 +189,7 @@ impl<'t> Parser<'t> { return false; } let n_raw_tokens = match kind { - SyntaxKind::COLON_COLON - | SyntaxKind::COLON_EQ + SyntaxKind::COLON_EQ | SyntaxKind::NEQ | SyntaxKind::NEQB | SyntaxKind::LTEQ @@ -244,6 +243,106 @@ impl<'t> Parser<'t> { m.complete(self, SyntaxKind::IS_NORMALIZED); return true; } + SyntaxKind::COLON_COLON => { + let m = self.start(); + self.bump(SyntaxKind::COLON); + self.bump(SyntaxKind::COLON); + m.complete(self, SyntaxKind::COLON_COLON); + return true; + } + SyntaxKind::IS_JSON => { + let m = self.start(); + self.bump(SyntaxKind::IS_KW); + self.bump(SyntaxKind::JSON_KW); + grammar::opt_json_keys_unique_clause(self); + m.complete(self, SyntaxKind::IS_JSON); + return true; + } + SyntaxKind::IS_NOT_JSON => { + let m = self.start(); + self.bump(SyntaxKind::IS_KW); + self.bump(SyntaxKind::NOT_KW); + self.bump(SyntaxKind::JSON_KW); + grammar::opt_json_keys_unique_clause(self); + m.complete(self, SyntaxKind::IS_NOT_JSON); + return true; + } + SyntaxKind::IS_NOT_JSON_OBJECT => { + let m = self.start(); + self.bump(SyntaxKind::IS_KW); + self.bump(SyntaxKind::NOT_KW); + self.bump(SyntaxKind::JSON_KW); + self.bump(SyntaxKind::OBJECT_KW); + grammar::opt_json_keys_unique_clause(self); + m.complete(self, SyntaxKind::IS_NOT_JSON_OBJECT); + return true; + } + SyntaxKind::IS_NOT_JSON_ARRAY => { + let m = self.start(); + self.bump(SyntaxKind::IS_KW); + self.bump(SyntaxKind::NOT_KW); + self.bump(SyntaxKind::JSON_KW); + self.bump(SyntaxKind::ARRAY_KW); + grammar::opt_json_keys_unique_clause(self); + m.complete(self, SyntaxKind::IS_NOT_JSON_ARRAY); + return true; + } + SyntaxKind::IS_NOT_JSON_VALUE => { + let m = self.start(); + self.bump(SyntaxKind::IS_KW); + self.bump(SyntaxKind::NOT_KW); + self.bump(SyntaxKind::JSON_KW); + self.bump(SyntaxKind::VALUE_KW); + grammar::opt_json_keys_unique_clause(self); + m.complete(self, SyntaxKind::IS_NOT_JSON_VALUE); + return true; + } + SyntaxKind::IS_NOT_JSON_SCALAR => { + let m = self.start(); + self.bump(SyntaxKind::IS_KW); + self.bump(SyntaxKind::NOT_KW); + self.bump(SyntaxKind::JSON_KW); + self.bump(SyntaxKind::SCALAR_KW); + grammar::opt_json_keys_unique_clause(self); + m.complete(self, SyntaxKind::IS_NOT_JSON_SCALAR); + return true; + } + SyntaxKind::IS_JSON_OBJECT => { + let m = self.start(); + self.bump(SyntaxKind::IS_KW); + self.bump(SyntaxKind::JSON_KW); + self.bump(SyntaxKind::OBJECT_KW); + grammar::opt_json_keys_unique_clause(self); + m.complete(self, SyntaxKind::IS_JSON_OBJECT); + return true; + } + SyntaxKind::IS_JSON_ARRAY => { + let m = self.start(); + self.bump(SyntaxKind::IS_KW); + self.bump(SyntaxKind::JSON_KW); + self.bump(SyntaxKind::ARRAY_KW); + grammar::opt_json_keys_unique_clause(self); + m.complete(self, SyntaxKind::IS_JSON_ARRAY); + return true; + } + SyntaxKind::IS_JSON_VALUE => { + let m = self.start(); + self.bump(SyntaxKind::IS_KW); + self.bump(SyntaxKind::JSON_KW); + self.bump(SyntaxKind::VALUE_KW); + grammar::opt_json_keys_unique_clause(self); + m.complete(self, SyntaxKind::IS_JSON_VALUE); + return true; + } + SyntaxKind::IS_JSON_SCALAR => { + let m = self.start(); + self.bump(SyntaxKind::IS_KW); + self.bump(SyntaxKind::JSON_KW); + self.bump(SyntaxKind::SCALAR_KW); + grammar::opt_json_keys_unique_clause(self); + m.complete(self, SyntaxKind::IS_JSON_SCALAR); + return true; + } SyntaxKind::IS_NOT_DISTINCT_FROM => { let m = self.start(); self.bump(SyntaxKind::IS_KW); @@ -430,7 +529,7 @@ impl<'t> Parser<'t> { if kind == SyntaxKind::EOF { return; } - self.bump(kind); + self.do_bump(kind, 1); } /// Advances the parser by one token @@ -683,6 +782,80 @@ impl<'t> Parser<'t> { SyntaxKind::L_PAREN, TrivaBetween::Allowed, ), + // is json + SyntaxKind::IS_JSON => self.at_composite2( + n, + SyntaxKind::IS_KW, + SyntaxKind::JSON_KW, + TrivaBetween::Allowed, + ), + // is not json + SyntaxKind::IS_NOT_JSON => self.at_composite3( + n, + SyntaxKind::IS_KW, + SyntaxKind::NOT_KW, + SyntaxKind::JSON_KW, + ), + // is not json object + SyntaxKind::IS_NOT_JSON_OBJECT => self.at_composite4( + n, + SyntaxKind::IS_KW, + SyntaxKind::NOT_KW, + SyntaxKind::JSON_KW, + SyntaxKind::OBJECT_KW, + ), + // is not json array + SyntaxKind::IS_NOT_JSON_ARRAY => self.at_composite4( + n, + SyntaxKind::IS_KW, + SyntaxKind::NOT_KW, + SyntaxKind::JSON_KW, + SyntaxKind::ARRAY_KW, + ), + // is not json value + SyntaxKind::IS_NOT_JSON_VALUE => self.at_composite4( + n, + SyntaxKind::IS_KW, + SyntaxKind::NOT_KW, + SyntaxKind::JSON_KW, + SyntaxKind::VALUE_KW, + ), + // is not json scalar + SyntaxKind::IS_NOT_JSON_SCALAR => self.at_composite4( + n, + SyntaxKind::IS_KW, + SyntaxKind::NOT_KW, + SyntaxKind::JSON_KW, + SyntaxKind::SCALAR_KW, + ), + // is json object + SyntaxKind::IS_JSON_OBJECT => self.at_composite3( + n, + SyntaxKind::IS_KW, + SyntaxKind::JSON_KW, + SyntaxKind::OBJECT_KW, + ), + // is json array + SyntaxKind::IS_JSON_ARRAY => self.at_composite3( + n, + SyntaxKind::IS_KW, + SyntaxKind::JSON_KW, + SyntaxKind::ARRAY_KW, + ), + // is json value + SyntaxKind::IS_JSON_VALUE => self.at_composite3( + n, + SyntaxKind::IS_KW, + SyntaxKind::JSON_KW, + SyntaxKind::VALUE_KW, + ), + // is json scalar + SyntaxKind::IS_JSON_SCALAR => self.at_composite3( + n, + SyntaxKind::IS_KW, + SyntaxKind::JSON_KW, + SyntaxKind::SCALAR_KW, + ), // <= SyntaxKind::LTEQ => self.at_composite2( n, diff --git a/crates/squawk_parser/tests/data/regression_suite/errors.sql b/crates/squawk_parser/tests/data/regression_suite/errors.sql index 5a8c24c0..a828bbd0 100644 --- a/crates/squawk_parser/tests/data/regression_suite/errors.sql +++ b/crates/squawk_parser/tests/data/regression_suite/errors.sql @@ -26,7 +26,7 @@ select * from nonesuch; select nonesuch from pg_database; -- empty distinct list isn't OK -select distinct from pg_database; +-- select distinct from pg_database; -- bad attribute name on lhs of operator select * from pg_database where nonesuch = pg_database.datname; @@ -46,7 +46,7 @@ select null from pg_database group by grouping sets (()) for update; -- DELETE -- missing relation name (this had better not wildcard!) -delete from; +-- delete from; -- no such relation delete from nonesuch; @@ -56,7 +56,7 @@ delete from nonesuch; -- DROP -- missing relation name (this had better not wildcard!) -drop table; +-- drop table; -- no such relation drop table nonesuch; @@ -128,10 +128,10 @@ create aggregate newcnt1 (sfunc = int4inc, -- DROP INDEX -- missing index name -drop index; +-- drop index; -- bad index name -drop index 314159; +-- drop index 314159; -- no such index drop index nonesuch; @@ -141,13 +141,13 @@ drop index nonesuch; -- DROP AGGREGATE -- missing aggregate name -drop aggregate; +-- drop aggregate; -- missing aggregate type -drop aggregate newcnt1; +-- drop aggregate newcnt1; -- bad aggregate name -drop aggregate 314159 (int); +-- drop aggregate 314159 (int); -- bad aggregate type drop aggregate newcnt (nonesuch); @@ -163,10 +163,10 @@ drop aggregate newcnt (float4); -- DROP FUNCTION -- missing function name -drop function (); +-- drop function (); -- bad function name -drop function 314159(); +-- drop function 314159(); -- no such function drop function nonesuch(); @@ -176,10 +176,10 @@ drop function nonesuch(); -- DROP TYPE -- missing type name -drop type; +-- drop type; -- bad type name -drop type 314159; +-- drop type 314159; -- no such type drop type nonesuch; @@ -189,34 +189,34 @@ drop type nonesuch; -- DROP OPERATOR -- missing everything -drop operator; +-- drop operator; -- bad operator name -drop operator equals; +-- drop operator equals; -- missing type list -drop operator ===; +-- drop operator ===; -- missing parentheses -drop operator int4, int4; +-- drop operator int4, int4; -- missing operator name -drop operator (int4, int4); +-- drop operator (int4, int4); -- missing type list contents -drop operator === (); +-- drop operator === (); -- no such operator -drop operator === (int4); +-- drop operator === (int4); -- no such operator by that name drop operator === (int4, int4); -- no such type1 -drop operator = (nonesuch); +-- drop operator = (nonesuch); -- no such type1 -drop operator = ( , int4); +-- drop operator = ( , int4); -- no such type1 drop operator = (nonesuch, int4); @@ -225,25 +225,25 @@ drop operator = (nonesuch, int4); drop operator = (int4, nonesuch); -- no such type2 -drop operator = (int4, ); +-- drop operator = (int4, ); -- -- DROP RULE -- missing rule name -drop rule; +-- drop rule; -- bad rule name -drop rule 314159; +-- drop rule 314159; -- no such rule drop rule nonesuch on noplace; -- these postquel variants are no longer supported -drop tuple rule nonesuch; -drop instance rule nonesuch on noplace; -drop rewrite rule nonesuch; +-- drop tuple rule nonesuch; +-- drop instance rule nonesuch on noplace; +-- drop rewrite rule nonesuch; -- -- Check that division-by-zero is properly caught. @@ -272,98 +272,98 @@ select 1::float4/0; select 1/0::float4; --- --- Test psql's reporting of syntax error location --- - -xxx; - -CREATE foo; - -CREATE TABLE ; - -CREATE TABLE - -INSERT INTO foo VALUES(123) foo; - -INSERT INTO 123 -VALUES(123); - -INSERT INTO foo -VALUES(123) 123 -; - --- with a tab -CREATE TABLE foo - (id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, - id3 INTEGER NOT NUL, - id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL); - --- long line to be truncated on the left -CREATE TABLE foo(id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL, -id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL); - --- long line to be truncated on the right -CREATE TABLE foo( -id3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL, id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY); - --- long line to be truncated both ways -CREATE TABLE foo(id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL); - --- long line to be truncated on the left, many lines -CREATE -TEMPORARY -TABLE -foo(id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL, -id4 INT4 -UNIQUE -NOT -NULL, -id5 TEXT -UNIQUE -NOT -NULL) -; - --- long line to be truncated on the right, many lines -CREATE -TEMPORARY -TABLE -foo( -id3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL, id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY) -; - --- long line to be truncated both ways, many lines -CREATE -TEMPORARY -TABLE -foo -(id -INT4 -UNIQUE NOT NULL, idx INT4 UNIQUE NOT NULL, idy INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL, -idz INT4 UNIQUE NOT NULL, -idv INT4 UNIQUE NOT NULL); +-- -- +-- -- Test psql's reporting of syntax error location +-- -- + +-- xxx; + +-- CREATE foo; + +-- CREATE TABLE ; + +-- CREATE TABLE + +-- INSERT INTO foo VALUES(123) foo; + +-- INSERT INTO 123 +-- VALUES(123); + +-- INSERT INTO foo +-- VALUES(123) 123 +-- ; + +-- -- with a tab +-- CREATE TABLE foo +-- (id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, +-- id3 INTEGER NOT NUL, +-- id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL); + +-- -- long line to be truncated on the left +-- CREATE TABLE foo(id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL, +-- id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL); + +-- -- long line to be truncated on the right +-- CREATE TABLE foo( +-- id3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL, id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY); + +-- -- long line to be truncated both ways +-- CREATE TABLE foo(id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL); + +-- -- long line to be truncated on the left, many lines +-- CREATE +-- TEMPORARY +-- TABLE +-- foo(id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL, +-- id4 INT4 +-- UNIQUE +-- NOT +-- NULL, +-- id5 TEXT +-- UNIQUE +-- NOT +-- NULL) +-- ; + +-- -- long line to be truncated on the right, many lines +-- CREATE +-- TEMPORARY +-- TABLE +-- foo( +-- id3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL, id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY) +-- ; + +-- -- long line to be truncated both ways, many lines +-- CREATE +-- TEMPORARY +-- TABLE +-- foo +-- (id +-- INT4 +-- UNIQUE NOT NULL, idx INT4 UNIQUE NOT NULL, idy INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL, +-- idz INT4 UNIQUE NOT NULL, +-- idv INT4 UNIQUE NOT NULL); -- more than 10 lines... -CREATE -TEMPORARY -TABLE -foo -(id -INT4 -UNIQUE -NOT -NULL -, -idm -INT4 -UNIQUE -NOT -NULL, -idx INT4 UNIQUE NOT NULL, idy INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL, -idz INT4 UNIQUE NOT NULL, -idv -INT4 -UNIQUE -NOT -NULL); +-- CREATE +-- TEMPORARY +-- TABLE +-- foo +-- (id +-- INT4 +-- UNIQUE +-- NOT +-- NULL +-- , +-- idm +-- INT4 +-- UNIQUE +-- NOT +-- NULL, +-- idx INT4 UNIQUE NOT NULL, idy INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL, +-- idz INT4 UNIQUE NOT NULL, +-- idv +-- INT4 +-- UNIQUE +-- NOT +-- NULL); diff --git a/crates/squawk_parser/tests/data/regression_suite/returning.sql b/crates/squawk_parser/tests/data/regression_suite/returning.sql index 39e9a2ed..befb1bff 100644 --- a/crates/squawk_parser/tests/data/regression_suite/returning.sql +++ b/crates/squawk_parser/tests/data/regression_suite/returning.sql @@ -194,11 +194,11 @@ TRUNCATE foo; INSERT INTO foo VALUES (1, 'xxx', 10, 20), (2, 'more', 42, 141), (3, 'zoo2', 57, 99); -- Error cases -INSERT INTO foo DEFAULT VALUES RETURNING WITH (nonsuch AS something) *; -INSERT INTO foo DEFAULT VALUES RETURNING WITH (new AS foo) *; -INSERT INTO foo DEFAULT VALUES RETURNING WITH (old AS o, new AS n, old AS o) *; -INSERT INTO foo DEFAULT VALUES RETURNING WITH (old AS o, new AS n, new AS n) *; -INSERT INTO foo DEFAULT VALUES RETURNING WITH (old AS x, new AS x) *; +-- INSERT INTO foo DEFAULT VALUES RETURNING WITH (nonsuch AS something) *; +-- INSERT INTO foo DEFAULT VALUES RETURNING WITH (new AS foo) *; +-- INSERT INTO foo DEFAULT VALUES RETURNING WITH (old AS o, new AS n, old AS o) *; +-- INSERT INTO foo DEFAULT VALUES RETURNING WITH (old AS o, new AS n, new AS n) *; +-- INSERT INTO foo DEFAULT VALUES RETURNING WITH (old AS x, new AS x) *; -- INSERT has NEW, but not OLD EXPLAIN (verbose, costs off) diff --git a/crates/squawk_parser/tests/data/regression_suite/transactions.sql b/crates/squawk_parser/tests/data/regression_suite/transactions.sql index 51ae1b31..0568a355 100644 --- a/crates/squawk_parser/tests/data/regression_suite/transactions.sql +++ b/crates/squawk_parser/tests/data/regression_suite/transactions.sql @@ -528,101 +528,101 @@ RESET default_transaction_read_only; DROP TABLE trans_abc; --- Test assorted behaviors around the implicit transaction block created --- when multiple SQL commands are sent in a single Query message. These --- tests rely on the fact that psql will not break SQL commands apart at a --- backslash-quoted semicolon, but will send them as one Query. +-- -- Test assorted behaviors around the implicit transaction block created +-- -- when multiple SQL commands are sent in a single Query message. These +-- -- tests rely on the fact that psql will not break SQL commands apart at a +-- -- backslash-quoted semicolon, but will send them as one Query. -create temp table i_table (f1 int); +-- create temp table i_table (f1 int); --- psql will show all results of a multi-statement Query -SELECT 1\; SELECT 2\; SELECT 3; +-- -- psql will show all results of a multi-statement Query +-- SELECT 1\; SELECT 2\; SELECT 3; --- this implicitly commits: -insert into i_table values(1)\; select * from i_table; --- 1/0 error will cause rolling back the whole implicit transaction -insert into i_table values(2)\; select * from i_table\; select 1/0; -select * from i_table; +-- -- this implicitly commits: +-- insert into i_table values(1)\; select * from i_table; +-- -- 1/0 error will cause rolling back the whole implicit transaction +-- insert into i_table values(2)\; select * from i_table\; select 1/0; +-- select * from i_table; -rollback; -- we are not in a transaction at this point +-- rollback; -- we are not in a transaction at this point --- can use regular begin/commit/rollback within a single Query -begin\; insert into i_table values(3)\; commit; -rollback; -- we are not in a transaction at this point -begin\; insert into i_table values(4)\; rollback; -rollback; -- we are not in a transaction at this point +-- -- can use regular begin/commit/rollback within a single Query +-- begin\; insert into i_table values(3)\; commit; +-- rollback; -- we are not in a transaction at this point +-- begin\; insert into i_table values(4)\; rollback; +-- rollback; -- we are not in a transaction at this point --- begin converts implicit transaction into a regular one that --- can extend past the end of the Query -select 1\; begin\; insert into i_table values(5); -commit; -select 1\; begin\; insert into i_table values(6); -rollback; +-- -- begin converts implicit transaction into a regular one that +-- -- can extend past the end of the Query +-- select 1\; begin\; insert into i_table values(5); +-- commit; +-- select 1\; begin\; insert into i_table values(6); +-- rollback; --- commit in implicit-transaction state commits but issues a warning. -insert into i_table values(7)\; commit\; insert into i_table values(8)\; select 1/0; --- similarly, rollback aborts but issues a warning. -insert into i_table values(9)\; rollback\; select 2; +-- -- commit in implicit-transaction state commits but issues a warning. +-- insert into i_table values(7)\; commit\; insert into i_table values(8)\; select 1/0; +-- -- similarly, rollback aborts but issues a warning. +-- insert into i_table values(9)\; rollback\; select 2; -select * from i_table; +-- select * from i_table; -rollback; -- we are not in a transaction at this point +-- rollback; -- we are not in a transaction at this point --- implicit transaction block is still a transaction block, for e.g. VACUUM -SELECT 1\; VACUUM; -SELECT 1\; COMMIT\; VACUUM; +-- -- implicit transaction block is still a transaction block, for e.g. VACUUM +-- SELECT 1\; VACUUM; +-- SELECT 1\; COMMIT\; VACUUM; --- we disallow savepoint-related commands in implicit-transaction state -SELECT 1\; SAVEPOINT sp; -SELECT 1\; COMMIT\; SAVEPOINT sp; -ROLLBACK TO SAVEPOINT sp\; SELECT 2; -SELECT 2\; RELEASE SAVEPOINT sp\; SELECT 3; +-- -- we disallow savepoint-related commands in implicit-transaction state +-- SELECT 1\; SAVEPOINT sp; +-- SELECT 1\; COMMIT\; SAVEPOINT sp; +-- ROLLBACK TO SAVEPOINT sp\; SELECT 2; +-- SELECT 2\; RELEASE SAVEPOINT sp\; SELECT 3; --- but this is OK, because the BEGIN converts it to a regular xact -SELECT 1\; BEGIN\; SAVEPOINT sp\; ROLLBACK TO SAVEPOINT sp\; COMMIT; +-- -- but this is OK, because the BEGIN converts it to a regular xact +-- SELECT 1\; BEGIN\; SAVEPOINT sp\; ROLLBACK TO SAVEPOINT sp\; COMMIT; --- Tests for AND CHAIN in implicit transaction blocks +-- -- Tests for AND CHAIN in implicit transaction blocks -SET TRANSACTION READ ONLY\; COMMIT AND CHAIN; -- error -SHOW transaction_read_only; +-- SET TRANSACTION READ ONLY\; COMMIT AND CHAIN; -- error +-- SHOW transaction_read_only; -SET TRANSACTION READ ONLY\; ROLLBACK AND CHAIN; -- error -SHOW transaction_read_only; +-- SET TRANSACTION READ ONLY\; ROLLBACK AND CHAIN; -- error +-- SHOW transaction_read_only; -CREATE TABLE trans_abc (a int); +-- CREATE TABLE trans_abc (a int); --- COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN -INSERT INTO trans_abc VALUES (7)\; COMMIT\; INSERT INTO trans_abc VALUES (8)\; COMMIT AND CHAIN; -- 7 commit, 8 error -INSERT INTO trans_abc VALUES (9)\; ROLLBACK\; INSERT INTO trans_abc VALUES (10)\; ROLLBACK AND CHAIN; -- 9 rollback, 10 error +-- -- COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN +-- INSERT INTO trans_abc VALUES (7)\; COMMIT\; INSERT INTO trans_abc VALUES (8)\; COMMIT AND CHAIN; -- 7 commit, 8 error +-- INSERT INTO trans_abc VALUES (9)\; ROLLBACK\; INSERT INTO trans_abc VALUES (10)\; ROLLBACK AND CHAIN; -- 9 rollback, 10 error --- COMMIT/ROLLBACK AND CHAIN + COMMIT/ROLLBACK -INSERT INTO trans_abc VALUES (11)\; COMMIT AND CHAIN\; INSERT INTO trans_abc VALUES (12)\; COMMIT; -- 11 error, 12 not reached -INSERT INTO trans_abc VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTO trans_abc VALUES (14)\; ROLLBACK; -- 13 error, 14 not reached +-- -- COMMIT/ROLLBACK AND CHAIN + COMMIT/ROLLBACK +-- INSERT INTO trans_abc VALUES (11)\; COMMIT AND CHAIN\; INSERT INTO trans_abc VALUES (12)\; COMMIT; -- 11 error, 12 not reached +-- INSERT INTO trans_abc VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTO trans_abc VALUES (14)\; ROLLBACK; -- 13 error, 14 not reached --- START TRANSACTION + COMMIT/ROLLBACK AND CHAIN -START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (15)\; COMMIT AND CHAIN; -- 15 ok -SHOW transaction_isolation; -- transaction is active at this point -COMMIT; +-- -- START TRANSACTION + COMMIT/ROLLBACK AND CHAIN +-- START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (15)\; COMMIT AND CHAIN; -- 15 ok +-- SHOW transaction_isolation; -- transaction is active at this point +-- COMMIT; -START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok -SHOW transaction_isolation; -- transaction is active at this point -ROLLBACK; +-- START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok +-- SHOW transaction_isolation; -- transaction is active at this point +-- ROLLBACK; -SET default_transaction_isolation = 'read committed'; +-- SET default_transaction_isolation = 'read committed'; --- START TRANSACTION + COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN -START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (17)\; COMMIT\; INSERT INTO trans_abc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error -SHOW transaction_isolation; -- out of transaction block +-- -- START TRANSACTION + COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN +-- START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (17)\; COMMIT\; INSERT INTO trans_abc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error +-- SHOW transaction_isolation; -- out of transaction block -START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (19)\; ROLLBACK\; INSERT INTO trans_abc VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error -SHOW transaction_isolation; -- out of transaction block +-- START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (19)\; ROLLBACK\; INSERT INTO trans_abc VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error +-- SHOW transaction_isolation; -- out of transaction block -RESET default_transaction_isolation; +-- RESET default_transaction_isolation; -SELECT * FROM trans_abc ORDER BY 1; +-- SELECT * FROM trans_abc ORDER BY 1; -DROP TABLE trans_abc; +-- DROP TABLE trans_abc; -- TRANSACTION SNAPSHOT -- Incorrect identifier. diff --git a/crates/squawk_parser/tests/snapshots/tests__delete_ok.snap b/crates/squawk_parser/tests/snapshots/tests__delete_ok.snap index 5ff69a75..e31d5653 100644 --- a/crates/squawk_parser/tests/snapshots/tests__delete_ok.snap +++ b/crates/squawk_parser/tests/snapshots/tests__delete_ok.snap @@ -152,9 +152,12 @@ SOURCE_FILE LITERAL INT_NUMBER "10" WHITESPACE "\n " - RETURNING_KW "returning" - WHITESPACE " " - STAR "*" + RETURNING_CLAUSE + RETURNING_KW "returning" + WHITESPACE " " + TARGET_LIST + TARGET + STAR "*" SEMICOLON ";" WHITESPACE "\n\n" COMMENT "-- using" @@ -345,9 +348,12 @@ SOURCE_FILE LITERAL INT_NUMBER "10" WHITESPACE "\n " - RETURNING_KW "returning" - WHITESPACE " " - STAR "*" + RETURNING_CLAUSE + RETURNING_KW "returning" + WHITESPACE " " + TARGET_LIST + TARGET + STAR "*" SEMICOLON ";" WHITESPACE "\n\n" COMMENT "-- returning" @@ -411,30 +417,35 @@ SOURCE_FILE WHITESPACE "\n" R_PAREN ")" WHITESPACE "\n" - RETURNING_KW "returning" - WHITESPACE " " - FIELD_EXPR - NAME_REF - IDENT "e" - DOT "." - NAME_REF - IDENT "employee_id" - COMMA "," - WHITESPACE " " - FIELD_EXPR - NAME_REF - IDENT "e" - DOT "." - NAME_REF - NAME_KW "name" - COMMA "," - WHITESPACE " " - FIELD_EXPR - NAME_REF - IDENT "e" - DOT "." - NAME_REF - IDENT "department_id" + RETURNING_CLAUSE + RETURNING_KW "returning" + WHITESPACE " " + TARGET_LIST + TARGET + FIELD_EXPR + NAME_REF + IDENT "e" + DOT "." + NAME_REF + IDENT "employee_id" + COMMA "," + WHITESPACE " " + TARGET + FIELD_EXPR + NAME_REF + IDENT "e" + DOT "." + NAME_REF + NAME_KW "name" + COMMA "," + WHITESPACE " " + TARGET + FIELD_EXPR + NAME_REF + IDENT "e" + DOT "." + NAME_REF + IDENT "department_id" SEMICOLON ";" WHITESPACE "\n\n" COMMENT "-- cursor" @@ -472,26 +483,31 @@ SOURCE_FILE NAME_REF IDENT "t" WHITESPACE " \n" - RETURNING_KW "returning" - WHITESPACE " " - STAR "*" - COMMA "," - WHITESPACE " " - BIN_EXPR - NAME_REF - IDENT "foo" - WHITESPACE " " - PLUS "+" + RETURNING_CLAUSE + RETURNING_KW "returning" WHITESPACE " " - NAME_REF - IDENT "bar" - COMMA "," - WHITESPACE " " - FIELD_EXPR - NAME_REF - IDENT "foo" - DOT "." - STAR "*" + TARGET_LIST + TARGET + STAR "*" + COMMA "," + WHITESPACE " " + TARGET + BIN_EXPR + NAME_REF + IDENT "foo" + WHITESPACE " " + PLUS "+" + WHITESPACE " " + NAME_REF + IDENT "bar" + COMMA "," + WHITESPACE " " + TARGET + FIELD_EXPR + NAME_REF + IDENT "foo" + DOT "." + STAR "*" SEMICOLON ";" WHITESPACE "\n\n\n" COMMENT "-- with" @@ -875,9 +891,12 @@ SOURCE_FILE LITERAL STRING "'DONE'" WHITESPACE " " - RETURNING_KW "RETURNING" - WHITESPACE " " - STAR "*" + RETURNING_CLAUSE + RETURNING_KW "RETURNING" + WHITESPACE " " + TARGET_LIST + TARGET + STAR "*" SEMICOLON ";" WHITESPACE "\n\n" DELETE diff --git a/crates/squawk_parser/tests/snapshots/tests__explain_ok.snap b/crates/squawk_parser/tests/snapshots/tests__explain_ok.snap index 950ef180..f0d6aee9 100644 --- a/crates/squawk_parser/tests/snapshots/tests__explain_ok.snap +++ b/crates/squawk_parser/tests/snapshots/tests__explain_ok.snap @@ -531,12 +531,11 @@ SOURCE_FILE CAST_EXPR LITERAL POSITIONAL_PARAM "$1" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - INTEGER_KW "integer" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + INTEGER_KW "integer" WHITESPACE " " AND_KW "AND" WHITESPACE " " @@ -549,12 +548,11 @@ SOURCE_FILE CAST_EXPR LITERAL POSITIONAL_PARAM "$2" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - INTEGER_KW "integer" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + INTEGER_KW "integer" WHITESPACE "\n " GROUP_BY_CLAUSE GROUP_KW "GROUP" diff --git a/crates/squawk_parser/tests/snapshots/tests__insert_ok.snap b/crates/squawk_parser/tests/snapshots/tests__insert_ok.snap index ca2b2a47..a650025a 100644 --- a/crates/squawk_parser/tests/snapshots/tests__insert_ok.snap +++ b/crates/squawk_parser/tests/snapshots/tests__insert_ok.snap @@ -811,10 +811,13 @@ SOURCE_FILE STRING "'XYZ Widgets'" R_PAREN ")" WHITESPACE "\n " - RETURNING_KW "RETURNING" - WHITESPACE " " - NAME_REF - IDENT "did" + RETURNING_CLAUSE + RETURNING_KW "RETURNING" + WHITESPACE " " + TARGET_LIST + TARGET + NAME_REF + IDENT "did" SEMICOLON ";" WHITESPACE "\n\n" INSERT @@ -894,9 +897,12 @@ SOURCE_FILE STRING "'Acme Corporation'" R_PAREN ")" WHITESPACE "\n " - RETURNING_KW "RETURNING" - WHITESPACE " " - STAR "*" + RETURNING_CLAUSE + RETURNING_KW "RETURNING" + WHITESPACE " " + TARGET_LIST + TARGET + STAR "*" WHITESPACE "\n" R_PAREN ")" WHITESPACE "\n" diff --git a/crates/squawk_parser/tests/snapshots/tests__merge_pg17_ok.snap b/crates/squawk_parser/tests/snapshots/tests__merge_pg17_ok.snap index 3a51dc3f..d86a5e6f 100644 --- a/crates/squawk_parser/tests/snapshots/tests__merge_pg17_ok.snap +++ b/crates/squawk_parser/tests/snapshots/tests__merge_pg17_ok.snap @@ -253,9 +253,12 @@ SOURCE_FILE WHITESPACE " " NOTHING_KW "nothing" WHITESPACE "\n " - RETURNING_KW "returning" - WHITESPACE " " - STAR "*" + RETURNING_CLAUSE + RETURNING_KW "returning" + WHITESPACE " " + TARGET_LIST + TARGET + STAR "*" SEMICOLON ";" WHITESPACE "\n\n" COMMENT "-- returning_many" @@ -334,42 +337,47 @@ SOURCE_FILE WHITESPACE " " NOTHING_KW "nothing" WHITESPACE "\n " - RETURNING_KW "returning" - WHITESPACE " " - STAR "*" - COMMA "," - WHITESPACE " " - NAME_REF - IDENT "u" - WHITESPACE " " - ALIAS - AS_KW "as" + RETURNING_CLAUSE + RETURNING_KW "returning" WHITESPACE " " - NAME - IDENT "bar" - COMMA "," - WHITESPACE " " - NAME_REF - IDENT "t" - WHITESPACE " " - ALIAS - NAME - IDENT "b" - COMMA "," - WHITESPACE " " - CALL_EXPR - NAME_REF - MERGE_ACTION_KW "merge_action" - ARG_LIST - L_PAREN "(" - R_PAREN ")" - COMMA "," - WHITESPACE " " - FIELD_EXPR - NAME_REF - IDENT "t" - DOT "." - STAR "*" + TARGET_LIST + TARGET + STAR "*" + COMMA "," + WHITESPACE " " + TARGET + NAME_REF + IDENT "u" + WHITESPACE " " + AS_KW "as" + WHITESPACE " " + NAME + IDENT "bar" + COMMA "," + WHITESPACE " " + TARGET + NAME_REF + IDENT "t" + WHITESPACE " " + NAME + IDENT "b" + COMMA "," + WHITESPACE " " + TARGET + CALL_EXPR + NAME_REF + MERGE_ACTION_KW "merge_action" + ARG_LIST + L_PAREN "(" + R_PAREN ")" + COMMA "," + WHITESPACE " " + TARGET + FIELD_EXPR + NAME_REF + IDENT "t" + DOT "." + STAR "*" SEMICOLON ";" WHITESPACE "\n\n" COMMENT "-- merge_insert_simple" @@ -1307,21 +1315,25 @@ SOURCE_FILE WHITESPACE "\n " DELETE_KW "DELETE" WHITESPACE "\n" - RETURNING_KW "RETURNING" - WHITESPACE " " - CALL_EXPR - NAME_REF - MERGE_ACTION_KW "merge_action" - ARG_LIST - L_PAREN "(" - R_PAREN ")" - COMMA "," - WHITESPACE " " - FIELD_EXPR - NAME_REF - IDENT "w" - DOT "." - STAR "*" + RETURNING_CLAUSE + RETURNING_KW "RETURNING" + WHITESPACE " " + TARGET_LIST + TARGET + CALL_EXPR + NAME_REF + MERGE_ACTION_KW "merge_action" + ARG_LIST + L_PAREN "(" + R_PAREN ")" + COMMA "," + WHITESPACE " " + TARGET + FIELD_EXPR + NAME_REF + IDENT "w" + DOT "." + STAR "*" SEMICOLON ";" WHITESPACE "\n\n" COMMENT "-- doc_example_4" diff --git a/crates/squawk_parser/tests/snapshots/tests__misc_ok.snap b/crates/squawk_parser/tests/snapshots/tests__misc_ok.snap index 2c7926fc..d842d4ad 100644 --- a/crates/squawk_parser/tests/snapshots/tests__misc_ok.snap +++ b/crates/squawk_parser/tests/snapshots/tests__misc_ok.snap @@ -101,13 +101,12 @@ SOURCE_FILE CAST_EXPR LITERAL POSITIONAL_PARAM "$1" - COLON_COLON "::" - ARRAY_TYPE - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "timestamptz" + COLON_COLON + COLON ":" + COLON ":" + INDEX_EXPR + NAME_REF + IDENT "timestamptz" L_BRACK "[" R_BRACK "]" COMMA "," @@ -115,13 +114,12 @@ SOURCE_FILE CAST_EXPR LITERAL POSITIONAL_PARAM "$2" - COLON_COLON "::" - ARRAY_TYPE - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - TEXT_KW "text" + COLON_COLON + COLON ":" + COLON ":" + INDEX_EXPR + NAME_REF + TEXT_KW "text" L_BRACK "[" R_BRACK "]" COMMA "," @@ -129,13 +127,12 @@ SOURCE_FILE CAST_EXPR LITERAL POSITIONAL_PARAM "$3" - COLON_COLON "::" - ARRAY_TYPE - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "float8" + COLON_COLON + COLON ":" + COLON ":" + INDEX_EXPR + NAME_REF + IDENT "float8" L_BRACK "[" R_BRACK "]" WHITESPACE "\n" @@ -662,12 +659,11 @@ SOURCE_FILE CAST_EXPR LITERAL POSITIONAL_PARAM "$2" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" COMMA "," WHITESPACE "\n " NAMED_ARG @@ -993,12 +989,11 @@ SOURCE_FILE NAME_REF IDENT "interaction_ts" R_PAREN ")" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "int4" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "int4" COMMA "," WHITESPACE " " NAME_REF @@ -1049,12 +1044,11 @@ SOURCE_FILE NAME_REF IDENT "interaction_ts" R_PAREN ")" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "int4" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "int4" COMMA "," WHITESPACE " " NAME_REF @@ -1226,12 +1220,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'2024-12-25'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "date" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "date" R_PAREN ")" SEMICOLON ";" WHITESPACE "\n\n" @@ -1296,12 +1289,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'2024-12-25'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "date" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "date" R_PAREN ")" SEMICOLON ";" WHITESPACE "\n\n" @@ -1454,9 +1446,12 @@ SOURCE_FILE NAME_REF IDENT "time_taptest_table_default" WHITESPACE " " - RETURNING_KW "RETURNING" - WHITESPACE " " - STAR "*" + RETURNING_CLAUSE + RETURNING_KW "RETURNING" + WHITESPACE " " + TARGET_LIST + TARGET + STAR "*" WHITESPACE "\n" R_PAREN ")" WHITESPACE "\n" @@ -1584,9 +1579,12 @@ SOURCE_FILE NAME_REF IDENT "clean_default_temp" WHITESPACE " " - RETURNING_KW "RETURNING" - WHITESPACE " " - STAR "*" + RETURNING_CLAUSE + RETURNING_KW "RETURNING" + WHITESPACE " " + TARGET_LIST + TARGET + STAR "*" WHITESPACE "\n" R_PAREN ")" WHITESPACE "\n" @@ -2054,12 +2052,11 @@ SOURCE_FILE NAME_REF IDENT "plot" R_PAREN ")" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "vector" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "vector" SEMICOLON ";" WHITESPACE "\n\n" SELECT @@ -2113,12 +2110,11 @@ SOURCE_FILE LITERAL STRING "'What is the Star Trek episode where Deanna and her mother are kidnapped?'" R_PAREN ")" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "vector" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "vector" R_PAREN ")" WHITESPACE "\n" LIMIT_CLAUSE @@ -2508,12 +2504,11 @@ SOURCE_FILE ARG_LIST L_PAREN "(" R_PAREN ")" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "date" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "date" WHITESPACE " " GROUP_BY_CLAUSE GROUP_KW "group" @@ -3393,12 +3388,11 @@ SOURCE_FILE LITERAL STRING "'eventTypeGroups'" R_PAREN ")" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - JSON_KW "json" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + JSON_KW "json" R_PAREN ")" WHITESPACE " " ALIAS @@ -3428,12 +3422,11 @@ SOURCE_FILE LITERAL STRING "'eventTypes'" R_PAREN ")" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - JSON_KW "json" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + JSON_KW "json" R_PAREN ")" WHITESPACE " " ALIAS @@ -3559,12 +3552,11 @@ SOURCE_FILE LITERAL STRING "'bookings'" R_PAREN ")" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - JSON_KW "json" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + JSON_KW "json" R_PAREN ")" WHITESPACE " " ALIAS @@ -3603,12 +3595,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{\n \"start\": \"2025-01-01T23:30:00.000Z\",\n \"eventTypeId\": 1398027,\n \"attendee\": {\n \"name\": \"Elon Musk\",\n \"email\": \"elon.musk@x.com\",\n \"timeZone\": \"America/New_York\"\n }\n }'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" WHITESPACE "\n" R_PAREN ")" SEMICOLON ";" @@ -5621,36 +5612,32 @@ SOURCE_FILE CAST_EXPR NAME_REF IDENT "ctid" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - TEXT_KW "text" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "float8" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + TEXT_KW "text" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "float8" COMMA "," WHITESPACE " " CAST_EXPR CAST_EXPR NAME_REF TIMESTAMP_KW "timestamp" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - TEXT_KW "text" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "float8" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + TEXT_KW "text" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "float8" R_PAREN ")" WHITESPACE " " FROM_CLAUSE diff --git a/crates/squawk_parser/tests/snapshots/tests__regression_errors.snap b/crates/squawk_parser/tests/snapshots/tests__regression_errors.snap index 4bfab49e..bb2f317b 100644 --- a/crates/squawk_parser/tests/snapshots/tests__regression_errors.snap +++ b/crates/squawk_parser/tests/snapshots/tests__regression_errors.snap @@ -2,289 +2,4 @@ source: crates/squawk_parser/tests/tests.rs input_file: crates/squawk_parser/tests/data/regression_suite/errors.sql --- -ERROR@948: expected relation name -ERROR@1074: expected path name -ERROR@2188: expected path name -ERROR@2219: expected path name -ERROR@2219: expected SEMICOLON -ERROR@2220: expected command, found INT_NUMBER -ERROR@2331: expected path name -ERROR@2331: expected L_PAREN -ERROR@2331: expected type name -ERROR@2331: expected R_PAREN -ERROR@2382: expected L_PAREN -ERROR@2382: expected type name -ERROR@2382: expected R_PAREN -ERROR@2422: expected path name -ERROR@2422: expected L_PAREN -ERROR@2422: expected type name -ERROR@2422: expected R_PAREN -ERROR@2422: expected SEMICOLON -ERROR@2422: expected command, found INT_NUMBER -ERROR@2429: expected command, found L_PAREN -ERROR@2430: expected command, found INT_KW -ERROR@2433: expected command, found R_PAREN -ERROR@2671: expected path name -ERROR@2711: expected path name -ERROR@2711: expected SEMICOLON -ERROR@2712: expected command, found INT_NUMBER -ERROR@2718: expected command, found L_PAREN -ERROR@2719: expected command, found R_PAREN -ERROR@2818: expected path name -ERROR@2847: expected path name -ERROR@2847: expected SEMICOLON -ERROR@2848: expected command, found INT_NUMBER -ERROR@2951: expected operator, got SEMICOLON -ERROR@2951: expected L_PAREN -ERROR@2951: expected type name -ERROR@2951: expected COMMA -ERROR@2951: expected type name -ERROR@2951: expected R_PAREN -ERROR@2995: expected operator, got SEMICOLON -ERROR@2995: expected L_PAREN -ERROR@2995: expected type name -ERROR@2995: expected COMMA -ERROR@2995: expected type name -ERROR@2995: expected R_PAREN -ERROR@3036: expected L_PAREN -ERROR@3036: expected type name -ERROR@3036: expected COMMA -ERROR@3036: expected type name -ERROR@3036: expected R_PAREN -ERROR@3080: expected operator, got COMMA -ERROR@3080: expected L_PAREN -ERROR@3080: expected type name -ERROR@3086: expected R_PAREN -ERROR@3127: expected operator, got L_PAREN -ERROR@3192: expected type name -ERROR@3192: expected COMMA -ERROR@3192: expected type name -ERROR@3239: expected COMMA -ERROR@3239: expected type name -ERROR@3351: expected COMMA -ERROR@3351: expected type name -ERROR@3389: expected type name -ERROR@3543: expected type name -ERROR@3596: expected name -ERROR@3596: expected ON_KW -ERROR@3596: expected path name -ERROR@3625: expected name -ERROR@3625: expected ON_KW -ERROR@3625: expected path name -ERROR@3625: expected SEMICOLON -ERROR@3626: expected command, found INT_NUMBER -ERROR@3734: expected command, found DROP_KW -ERROR@3739: expected command, found IDENT -ERROR@3745: expected command, found RULE_KW -ERROR@3750: expected command, found IDENT -ERROR@3760: expected command, found DROP_KW -ERROR@3765: expected command, found IDENT -ERROR@3774: expected command, found RULE_KW -ERROR@3779: expected command, found IDENT -ERROR@3788: expected command, found ON_KW -ERROR@3791: expected command, found IDENT -ERROR@3800: expected command, found DROP_KW -ERROR@3805: expected command, found IDENT -ERROR@3813: expected command, found RULE_KW -ERROR@3818: expected command, found IDENT -ERROR@4162: expected command, found IDENT -ERROR@4168: expected command, found CREATE_KW -ERROR@4175: expected command, found IDENT -ERROR@4193: expected path name -ERROR@4217: expected SEMICOLON -ERROR@4218: expected command, found INTO_KW -ERROR@4223: expected command, found IDENT -ERROR@4238: expected SEMICOLON -ERROR@4239: expected command, found IDENT -ERROR@4256: expected path name -ERROR@4256: expected select stmt -ERROR@4256: expected SEMICOLON -ERROR@4257: expected command, found INT_NUMBER -ERROR@4302: expected SEMICOLON -ERROR@4303: expected command, found INT_NUMBER -ERROR@4416: expected NULL_KW -ERROR@4416: expected R_PAREN -ERROR@4416: expected SEMICOLON -ERROR@4417: expected command, found IDENT -ERROR@4420: expected command, found COMMA -ERROR@4425: expected command, found IDENT -ERROR@4429: expected command, found IDENT -ERROR@4434: expected command, found UNIQUE_KW -ERROR@4441: expected command, found NOT_KW -ERROR@4445: expected command, found NULL_KW -ERROR@4449: expected command, found COMMA -ERROR@4451: expected command, found IDENT -ERROR@4455: expected command, found TEXT_KW -ERROR@4460: expected command, found UNIQUE_KW -ERROR@4467: expected command, found NOT_KW -ERROR@4471: expected command, found NULL_KW -ERROR@4475: expected command, found R_PAREN -ERROR@4608: expected NULL_KW -ERROR@4608: expected R_PAREN -ERROR@4608: expected SEMICOLON -ERROR@4609: expected command, found IDENT -ERROR@4612: expected command, found COMMA -ERROR@4614: expected command, found IDENT -ERROR@4618: expected command, found IDENT -ERROR@4623: expected command, found UNIQUE_KW -ERROR@4630: expected command, found NOT_KW -ERROR@4634: expected command, found NULL_KW -ERROR@4638: expected command, found COMMA -ERROR@4640: expected command, found IDENT -ERROR@4644: expected command, found TEXT_KW -ERROR@4649: expected command, found UNIQUE_KW -ERROR@4656: expected command, found NOT_KW -ERROR@4660: expected command, found NULL_KW -ERROR@4664: expected command, found R_PAREN -ERROR@4743: expected NULL_KW -ERROR@4743: expected R_PAREN -ERROR@4743: expected SEMICOLON -ERROR@4744: expected command, found IDENT -ERROR@4747: expected command, found COMMA -ERROR@4749: expected command, found IDENT -ERROR@4753: expected command, found IDENT -ERROR@4758: expected command, found UNIQUE_KW -ERROR@4765: expected command, found NOT_KW -ERROR@4769: expected command, found NULL_KW -ERROR@4773: expected command, found COMMA -ERROR@4775: expected command, found IDENT -ERROR@4779: expected command, found TEXT_KW -ERROR@4784: expected command, found UNIQUE_KW -ERROR@4791: expected command, found NOT_KW -ERROR@4795: expected command, found NULL_KW -ERROR@4799: expected command, found COMMA -ERROR@4801: expected command, found IDENT -ERROR@4804: expected command, found IDENT -ERROR@4809: expected command, found UNIQUE_KW -ERROR@4816: expected command, found NOT_KW -ERROR@4820: expected command, found NULL_KW -ERROR@4824: expected command, found COMMA -ERROR@4826: expected command, found IDENT -ERROR@4830: expected command, found TEXT_KW -ERROR@4835: expected command, found NOT_KW -ERROR@4839: expected command, found NULL_KW -ERROR@4844: expected command, found PRIMARY_KW -ERROR@4852: expected command, found KEY_KW -ERROR@4855: expected command, found R_PAREN -ERROR@4986: expected NULL_KW -ERROR@4986: expected R_PAREN -ERROR@4986: expected SEMICOLON -ERROR@4987: expected command, found IDENT -ERROR@4990: expected command, found COMMA -ERROR@4992: expected command, found IDENT -ERROR@4996: expected command, found IDENT -ERROR@5001: expected command, found UNIQUE_KW -ERROR@5008: expected command, found NOT_KW -ERROR@5012: expected command, found NULL_KW -ERROR@5016: expected command, found COMMA -ERROR@5018: expected command, found IDENT -ERROR@5022: expected command, found TEXT_KW -ERROR@5027: expected command, found UNIQUE_KW -ERROR@5034: expected command, found NOT_KW -ERROR@5038: expected command, found NULL_KW -ERROR@5042: expected command, found R_PAREN -ERROR@5197: expected NULL_KW -ERROR@5197: expected R_PAREN -ERROR@5197: expected SEMICOLON -ERROR@5198: expected command, found IDENT -ERROR@5201: expected command, found COMMA -ERROR@5203: expected command, found IDENT -ERROR@5207: expected command, found IDENT -ERROR@5212: expected command, found UNIQUE_KW -ERROR@5219: expected command, found NOT_KW -ERROR@5223: expected command, found NULL_KW -ERROR@5227: expected command, found COMMA -ERROR@5229: expected command, found IDENT -ERROR@5233: expected command, found TEXT_KW -ERROR@5238: expected command, found UNIQUE_KW -ERROR@5245: expected command, found NOT_KW -ERROR@5249: expected command, found NULL_KW -ERROR@5253: expected command, found R_PAREN -ERROR@5355: expected NULL_KW -ERROR@5355: expected R_PAREN -ERROR@5355: expected SEMICOLON -ERROR@5356: expected command, found IDENT -ERROR@5359: expected command, found COMMA -ERROR@5361: expected command, found IDENT -ERROR@5365: expected command, found IDENT -ERROR@5370: expected command, found UNIQUE_KW -ERROR@5377: expected command, found NOT_KW -ERROR@5381: expected command, found NULL_KW -ERROR@5385: expected command, found COMMA -ERROR@5387: expected command, found IDENT -ERROR@5391: expected command, found TEXT_KW -ERROR@5396: expected command, found UNIQUE_KW -ERROR@5403: expected command, found NOT_KW -ERROR@5407: expected command, found NULL_KW -ERROR@5411: expected command, found COMMA -ERROR@5413: expected command, found IDENT -ERROR@5416: expected command, found IDENT -ERROR@5421: expected command, found UNIQUE_KW -ERROR@5428: expected command, found NOT_KW -ERROR@5432: expected command, found NULL_KW -ERROR@5436: expected command, found COMMA -ERROR@5438: expected command, found IDENT -ERROR@5442: expected command, found TEXT_KW -ERROR@5447: expected command, found NOT_KW -ERROR@5451: expected command, found NULL_KW -ERROR@5456: expected command, found PRIMARY_KW -ERROR@5464: expected command, found KEY_KW -ERROR@5467: expected command, found R_PAREN -ERROR@5674: expected NULL_KW -ERROR@5674: expected R_PAREN -ERROR@5674: expected SEMICOLON -ERROR@5675: expected command, found IDENT -ERROR@5678: expected command, found COMMA -ERROR@5680: expected command, found IDENT -ERROR@5684: expected command, found IDENT -ERROR@5689: expected command, found UNIQUE_KW -ERROR@5696: expected command, found NOT_KW -ERROR@5700: expected command, found NULL_KW -ERROR@5704: expected command, found COMMA -ERROR@5706: expected command, found IDENT -ERROR@5710: expected command, found TEXT_KW -ERROR@5715: expected command, found UNIQUE_KW -ERROR@5722: expected command, found NOT_KW -ERROR@5726: expected command, found NULL_KW -ERROR@5730: expected command, found COMMA -ERROR@5732: expected command, found IDENT -ERROR@5736: expected command, found IDENT -ERROR@5741: expected command, found UNIQUE_KW -ERROR@5748: expected command, found NOT_KW -ERROR@5752: expected command, found NULL_KW -ERROR@5756: expected command, found COMMA -ERROR@5758: expected command, found IDENT -ERROR@5762: expected command, found IDENT -ERROR@5767: expected command, found UNIQUE_KW -ERROR@5774: expected command, found NOT_KW -ERROR@5778: expected command, found NULL_KW -ERROR@5782: expected command, found R_PAREN -ERROR@5989: expected NULL_KW -ERROR@5989: expected R_PAREN -ERROR@5989: expected SEMICOLON -ERROR@5990: expected command, found IDENT -ERROR@5993: expected command, found COMMA -ERROR@5995: expected command, found IDENT -ERROR@5999: expected command, found IDENT -ERROR@6004: expected command, found UNIQUE_KW -ERROR@6011: expected command, found NOT_KW -ERROR@6015: expected command, found NULL_KW -ERROR@6019: expected command, found COMMA -ERROR@6021: expected command, found IDENT -ERROR@6025: expected command, found TEXT_KW -ERROR@6030: expected command, found UNIQUE_KW -ERROR@6037: expected command, found NOT_KW -ERROR@6041: expected command, found NULL_KW -ERROR@6045: expected command, found COMMA -ERROR@6047: expected command, found IDENT -ERROR@6051: expected command, found IDENT -ERROR@6056: expected command, found UNIQUE_KW -ERROR@6063: expected command, found NOT_KW -ERROR@6067: expected command, found NULL_KW -ERROR@6071: expected command, found COMMA -ERROR@6073: expected command, found IDENT -ERROR@6077: expected command, found IDENT -ERROR@6082: expected command, found UNIQUE_KW -ERROR@6089: expected command, found NOT_KW -ERROR@6093: expected command, found NULL_KW -ERROR@6097: expected command, found R_PAREN + diff --git a/crates/squawk_parser/tests/snapshots/tests__regression_returning.snap b/crates/squawk_parser/tests/snapshots/tests__regression_returning.snap index 5b77fb1c..3a3d0a10 100644 --- a/crates/squawk_parser/tests/snapshots/tests__regression_returning.snap +++ b/crates/squawk_parser/tests/snapshots/tests__regression_returning.snap @@ -2,233 +2,4 @@ source: crates/squawk_parser/tests/tests.rs input_file: crates/squawk_parser/tests/data/regression_suite/returning.sql --- -ERROR@5036: expected an expression, found WITH_KW -ERROR@5040: expected output expression -ERROR@5040: expected SEMICOLON -ERROR@5041: expected command, found L_PAREN -ERROR@5042: expected command, found IDENT -ERROR@5050: expected command, found AS_KW -ERROR@5053: expected command, found IDENT -ERROR@5062: expected command, found R_PAREN -ERROR@5064: expected command, found STAR -ERROR@5108: expected an expression, found WITH_KW -ERROR@5112: expected output expression -ERROR@5112: expected SEMICOLON -ERROR@5113: expected command, found L_PAREN -ERROR@5114: expected command, found NEW_KW -ERROR@5118: expected command, found AS_KW -ERROR@5121: expected command, found IDENT -ERROR@5124: expected command, found R_PAREN -ERROR@5126: expected command, found STAR -ERROR@5170: expected an expression, found WITH_KW -ERROR@5174: expected output expression -ERROR@5174: expected SEMICOLON -ERROR@5175: expected command, found L_PAREN -ERROR@5176: expected command, found OLD_KW -ERROR@5180: expected command, found AS_KW -ERROR@5183: expected command, found IDENT -ERROR@5184: expected command, found COMMA -ERROR@5186: expected command, found NEW_KW -ERROR@5190: expected command, found AS_KW -ERROR@5193: expected command, found IDENT -ERROR@5194: expected command, found COMMA -ERROR@5196: expected command, found OLD_KW -ERROR@5200: expected command, found AS_KW -ERROR@5203: expected command, found IDENT -ERROR@5204: expected command, found R_PAREN -ERROR@5206: expected command, found STAR -ERROR@5250: expected an expression, found WITH_KW -ERROR@5254: expected output expression -ERROR@5254: expected SEMICOLON -ERROR@5255: expected command, found L_PAREN -ERROR@5256: expected command, found OLD_KW -ERROR@5260: expected command, found AS_KW -ERROR@5263: expected command, found IDENT -ERROR@5264: expected command, found COMMA -ERROR@5266: expected command, found NEW_KW -ERROR@5270: expected command, found AS_KW -ERROR@5273: expected command, found IDENT -ERROR@5274: expected command, found COMMA -ERROR@5276: expected command, found NEW_KW -ERROR@5280: expected command, found AS_KW -ERROR@5283: expected command, found IDENT -ERROR@5284: expected command, found R_PAREN -ERROR@5286: expected command, found STAR -ERROR@5330: expected an expression, found WITH_KW -ERROR@5334: expected output expression -ERROR@5334: expected SEMICOLON -ERROR@5335: expected command, found L_PAREN -ERROR@5336: expected command, found OLD_KW -ERROR@5340: expected command, found AS_KW -ERROR@5343: expected command, found IDENT -ERROR@5344: expected command, found COMMA -ERROR@5346: expected command, found NEW_KW -ERROR@5350: expected command, found AS_KW -ERROR@5353: expected command, found IDENT -ERROR@5354: expected command, found R_PAREN -ERROR@5356: expected command, found STAR -ERROR@5946: expected an expression, found WITH_KW -ERROR@5950: expected output expression -ERROR@5950: expected SEMICOLON -ERROR@5951: expected command, found L_PAREN -ERROR@5952: expected command, found OLD_KW -ERROR@5956: expected command, found AS_KW -ERROR@5959: expected command, found IDENT -ERROR@5960: expected command, found COMMA -ERROR@5962: expected command, found NEW_KW -ERROR@5966: expected command, found AS_KW -ERROR@5969: expected command, found IDENT -ERROR@5970: expected command, found R_PAREN -ERROR@5984: expected command, found IDENT -ERROR@5985: expected command, found DOT -ERROR@5986: expected command, found IDENT -ERROR@5994: expected command, found COLON -ERROR@5995: expected command, found COLON -ERROR@5996: expected command, found IDENT -ERROR@6004: expected command, found COMMA -ERROR@6006: expected command, found IDENT -ERROR@6007: expected command, found DOT -ERROR@6008: expected command, found IDENT -ERROR@6012: expected command, found COMMA -ERROR@6014: expected command, found IDENT -ERROR@6015: expected command, found DOT -ERROR@6016: expected command, found STAR -ERROR@6017: expected command, found COMMA -ERROR@6031: expected command, found IDENT -ERROR@6032: expected command, found DOT -ERROR@6033: expected command, found IDENT -ERROR@6041: expected command, found COLON -ERROR@6042: expected command, found COLON -ERROR@6043: expected command, found IDENT -ERROR@6051: expected command, found COMMA -ERROR@6053: expected command, found IDENT -ERROR@6054: expected command, found DOT -ERROR@6055: expected command, found IDENT -ERROR@6059: expected command, found COMMA -ERROR@6061: expected command, found IDENT -ERROR@6062: expected command, found DOT -ERROR@6063: expected command, found STAR -ERROR@6064: expected command, found COMMA -ERROR@6066: expected command, found STAR -ERROR@6196: expected an expression, found WITH_KW -ERROR@6200: expected output expression -ERROR@6200: expected SEMICOLON -ERROR@6201: expected command, found L_PAREN -ERROR@6202: expected command, found OLD_KW -ERROR@6206: expected command, found AS_KW -ERROR@6209: expected command, found IDENT -ERROR@6210: expected command, found COMMA -ERROR@6212: expected command, found NEW_KW -ERROR@6216: expected command, found AS_KW -ERROR@6219: expected command, found IDENT -ERROR@6220: expected command, found R_PAREN -ERROR@6234: expected command, found IDENT -ERROR@6235: expected command, found DOT -ERROR@6236: expected command, found IDENT -ERROR@6244: expected command, found COLON -ERROR@6245: expected command, found COLON -ERROR@6246: expected command, found IDENT -ERROR@6254: expected command, found COMMA -ERROR@6256: expected command, found IDENT -ERROR@6257: expected command, found DOT -ERROR@6258: expected command, found IDENT -ERROR@6262: expected command, found COMMA -ERROR@6264: expected command, found IDENT -ERROR@6265: expected command, found DOT -ERROR@6266: expected command, found STAR -ERROR@6267: expected command, found COMMA -ERROR@6281: expected command, found IDENT -ERROR@6282: expected command, found DOT -ERROR@6283: expected command, found IDENT -ERROR@6291: expected command, found COLON -ERROR@6292: expected command, found COLON -ERROR@6293: expected command, found IDENT -ERROR@6301: expected command, found COMMA -ERROR@6303: expected command, found IDENT -ERROR@6304: expected command, found DOT -ERROR@6305: expected command, found IDENT -ERROR@6309: expected command, found COMMA -ERROR@6311: expected command, found IDENT -ERROR@6312: expected command, found DOT -ERROR@6313: expected command, found STAR -ERROR@6314: expected command, found COMMA -ERROR@6316: expected command, found STAR -ERROR@10619: expected an expression, found RETURNING_KW -ERROR@10628: expected an expression in target_el, found OLD_KW -ERROR@10675: expected an expression, found RETURNING_KW -ERROR@10684: expected an expression in target_el, found OLD_KW -ERROR@13248: expected an expression, found WITH_KW -ERROR@13252: expected output expression -ERROR@13252: expected R_PAREN -ERROR@13252: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: L_PAREN -ERROR@13253: expected command, found L_PAREN -ERROR@13254: expected command, found OLD_KW -ERROR@13258: expected command, found AS_KW -ERROR@13261: expected command, found IDENT -ERROR@13270: expected command, found R_PAREN -ERROR@13272: expected command, found IDENT -ERROR@13281: expected command, found DOT -ERROR@13282: expected command, found STAR -ERROR@13283: expected command, found COMMA -ERROR@13285: expected command, found NEW_KW -ERROR@13288: expected command, found DOT -ERROR@13289: expected command, found STAR -ERROR@13293: expected command, found R_PAREN -ERROR@13294: expected command, found COMMA -ERROR@13296: expected command, found IDENT -ERROR@13299: expected command, found AS_KW -ERROR@13302: expected command, found L_PAREN -ERROR@13345: expected an expression, found WITH_KW -ERROR@13349: expected output expression -ERROR@13350: expected command, found L_PAREN -ERROR@13351: expected command, found NEW_KW -ERROR@13355: expected command, found AS_KW -ERROR@13358: expected command, found IDENT -ERROR@13367: expected command, found R_PAREN -ERROR@13369: expected command, found OLD_KW -ERROR@13372: expected command, found DOT -ERROR@13373: expected command, found STAR -ERROR@13374: expected command, found COMMA -ERROR@13376: expected command, found IDENT -ERROR@13385: expected command, found DOT -ERROR@13386: expected command, found STAR -ERROR@13390: expected command, found R_PAREN -ERROR@13435: expected an expression, found WITH_KW -ERROR@13439: expected output expression -ERROR@13440: expected command, found L_PAREN -ERROR@13441: expected command, found OLD_KW -ERROR@13445: expected command, found AS_KW -ERROR@13448: expected command, found IDENT -ERROR@13449: expected command, found COMMA -ERROR@13451: expected command, found NEW_KW -ERROR@13455: expected command, found AS_KW -ERROR@13458: expected command, found IDENT -ERROR@13459: expected command, found R_PAREN -ERROR@13475: expected command, found IDENT -ERROR@13476: expected command, found DOT -ERROR@13477: expected command, found STAR -ERROR@13478: expected command, found COMMA -ERROR@13480: expected command, found IDENT -ERROR@13481: expected command, found DOT -ERROR@13482: expected command, found STAR -ERROR@13483: expected command, found COMMA -ERROR@13485: expected command, found IDENT -ERROR@13486: expected command, found COMMA -ERROR@13488: expected command, found IDENT -ERROR@13489: expected command, found COMMA -ERROR@13491: expected command, found IDENT -ERROR@13492: expected command, found DOT -ERROR@13493: expected command, found IDENT -ERROR@13496: expected command, found EQ -ERROR@13498: expected command, found IDENT -ERROR@13499: expected command, found DOT -ERROR@13500: expected command, found IDENT -ERROR@13502: expected command, found COMMA -ERROR@13504: expected command, found IDENT -ERROR@13506: expected command, found EQ -ERROR@13508: expected command, found IDENT -ERROR@13509: expected command, found COMMA -ERROR@13545: expected command, found COMMA -ERROR@13607: expected command, found COMMA -ERROR@13669: expected command, found COMMA -ERROR@13725: expected command, found COMMA + diff --git a/crates/squawk_parser/tests/snapshots/tests__regression_rules.snap b/crates/squawk_parser/tests/snapshots/tests__regression_rules.snap index 16273006..42b281c9 100644 --- a/crates/squawk_parser/tests/snapshots/tests__regression_rules.snap +++ b/crates/squawk_parser/tests/snapshots/tests__regression_rules.snap @@ -2,29 +2,4 @@ source: crates/squawk_parser/tests/tests.rs input_file: crates/squawk_parser/tests/data/regression_suite/rules.sql --- -ERROR@43277: expected an expression, found WITH_KW -ERROR@43281: expected output expression -ERROR@43282: expected command, found L_PAREN -ERROR@43283: expected command, found OLD_KW -ERROR@43287: expected command, found AS_KW -ERROR@43290: expected command, found IDENT -ERROR@43291: expected command, found COMMA -ERROR@43293: expected command, found NEW_KW -ERROR@43297: expected command, found AS_KW -ERROR@43300: expected command, found IDENT -ERROR@43301: expected command, found R_PAREN -ERROR@43306: expected command, found MERGE_ACTION_KW -ERROR@43318: expected command, found L_PAREN -ERROR@43319: expected command, found R_PAREN -ERROR@43321: expected command, found AS_KW -ERROR@43324: expected command, found ACTION_KW -ERROR@43330: expected command, found COMMA -ERROR@43332: expected command, found STAR -ERROR@43333: expected command, found COMMA -ERROR@43335: expected command, found IDENT -ERROR@43336: expected command, found DOT -ERROR@43337: expected command, found STAR -ERROR@43338: expected command, found COMMA -ERROR@43340: expected command, found IDENT -ERROR@43341: expected command, found DOT -ERROR@43342: expected command, found STAR + diff --git a/crates/squawk_parser/tests/snapshots/tests__regression_sqljson.snap b/crates/squawk_parser/tests/snapshots/tests__regression_sqljson.snap index b2ad4487..7c4c9dd3 100644 --- a/crates/squawk_parser/tests/snapshots/tests__regression_sqljson.snap +++ b/crates/squawk_parser/tests/snapshots/tests__regression_sqljson.snap @@ -2,1071 +2,4 @@ source: crates/squawk_parser/tests/tests.rs input_file: crates/squawk_parser/tests/data/regression_suite/sqljson.sql --- -ERROR@22: expected an expression, found R_PAREN -ERROR@22: expected expression -ERROR@1596: expected an expression, found R_PAREN -ERROR@1596: expected expression -ERROR@8559: expected R_PAREN -ERROR@8559: expected SEMICOLON -ERROR@8560: expected command, found RETURNING_KW -ERROR@8570: expected command, found IDENT -ERROR@8575: expected command, found R_PAREN -ERROR@8577: expected command, found IS_KW -ERROR@8580: expected command, found NULL_KW -ERROR@8585: expected command, found FROM_KW -ERROR@8590: expected command, found IDENT -ERROR@8605: expected command, found L_PAREN -ERROR@8606: expected command, found INT_NUMBER -ERROR@8607: expected command, found COMMA -ERROR@8609: expected command, found INT_NUMBER -ERROR@8610: expected command, found R_PAREN -ERROR@8612: expected command, found IDENT -ERROR@8658: expected R_PAREN -ERROR@8658: expected SEMICOLON -ERROR@8659: expected command, found RETURNING_KW -ERROR@8669: expected command, found IDENT -ERROR@8674: expected command, found R_PAREN -ERROR@8676: expected command, found FROM_KW -ERROR@8681: expected command, found IDENT -ERROR@8696: expected command, found L_PAREN -ERROR@8697: expected command, found INT_NUMBER -ERROR@8698: expected command, found COMMA -ERROR@8700: expected command, found INT_NUMBER -ERROR@8701: expected command, found R_PAREN -ERROR@8703: expected command, found IDENT -ERROR@8901: expected COMMA -ERROR@8908: expected COMMA -ERROR@8994: expected R_PAREN -ERROR@8994: expected SEMICOLON -ERROR@8995: expected command, found RETURNING_KW -ERROR@9005: expected command, found IDENT -ERROR@9010: expected command, found R_PAREN -ERROR@9012: expected command, found FROM_KW -ERROR@9017: expected command, found IDENT -ERROR@9032: expected command, found L_PAREN -ERROR@9033: expected command, found INT_NUMBER -ERROR@9034: expected command, found COMMA -ERROR@9036: expected command, found INT_NUMBER -ERROR@9037: expected command, found R_PAREN -ERROR@9066: expected COMMA -ERROR@9071: expected R_PAREN -ERROR@9071: expected SEMICOLON -ERROR@9072: expected command, found ON_KW -ERROR@9075: expected command, found NULL_KW -ERROR@9079: expected command, found R_PAREN -ERROR@9080: expected command, found COMMA -ERROR@9084: expected command, found JSON_ARRAYAGG_KW -ERROR@9097: expected command, found L_PAREN -ERROR@9098: expected command, found NULL_KW -ERROR@9103: expected command, found NULL_KW -ERROR@9108: expected command, found ON_KW -ERROR@9111: expected command, found NULL_KW -ERROR@9116: expected command, found RETURNING_KW -ERROR@9126: expected command, found IDENT -ERROR@9131: expected command, found R_PAREN -ERROR@9133: expected command, found FROM_KW -ERROR@9138: expected command, found IDENT -ERROR@9153: expected command, found L_PAREN -ERROR@9154: expected command, found INT_NUMBER -ERROR@9155: expected command, found COMMA -ERROR@9157: expected command, found INT_NUMBER -ERROR@9158: expected command, found R_PAREN -ERROR@9222: expected R_PAREN -ERROR@9222: expected SEMICOLON -ERROR@9223: expected command, found RETURNING_KW -ERROR@9233: expected command, found IDENT -ERROR@9238: expected command, found R_PAREN -ERROR@9240: expected command, found AS_KW -ERROR@9243: expected command, found IDENT -ERROR@9258: expected command, found COMMA -ERROR@9261: expected command, found JSON_ARRAYAGG_KW -ERROR@9274: expected command, found L_PAREN -ERROR@9275: expected command, found IDENT -ERROR@9279: expected command, found ABSENT_KW -ERROR@9286: expected command, found ON_KW -ERROR@9289: expected command, found NULL_KW -ERROR@9293: expected command, found R_PAREN -ERROR@9295: expected command, found AS_KW -ERROR@9298: expected command, found IDENT -ERROR@9312: expected command, found COMMA -ERROR@9315: expected command, found JSON_ARRAYAGG_KW -ERROR@9328: expected command, found L_PAREN -ERROR@9329: expected command, found IDENT -ERROR@9333: expected command, found ABSENT_KW -ERROR@9340: expected command, found ON_KW -ERROR@9343: expected command, found NULL_KW -ERROR@9348: expected command, found RETURNING_KW -ERROR@9358: expected command, found IDENT -ERROR@9363: expected command, found R_PAREN -ERROR@9365: expected command, found AS_KW -ERROR@9368: expected command, found IDENT -ERROR@9396: expected command, found COMMA -ERROR@9399: expected command, found JSON_ARRAYAGG_KW -ERROR@9412: expected command, found L_PAREN -ERROR@9413: expected command, found IDENT -ERROR@9417: expected command, found NULL_KW -ERROR@9422: expected command, found ON_KW -ERROR@9425: expected command, found NULL_KW -ERROR@9429: expected command, found R_PAREN -ERROR@9431: expected command, found AS_KW -ERROR@9434: expected command, found IDENT -ERROR@9446: expected command, found COMMA -ERROR@9449: expected command, found JSON_ARRAYAGG_KW -ERROR@9462: expected command, found L_PAREN -ERROR@9463: expected command, found IDENT -ERROR@9467: expected command, found NULL_KW -ERROR@9472: expected command, found ON_KW -ERROR@9475: expected command, found NULL_KW -ERROR@9480: expected command, found RETURNING_KW -ERROR@9490: expected command, found IDENT -ERROR@9495: expected command, found R_PAREN -ERROR@9497: expected command, found AS_KW -ERROR@9500: expected command, found IDENT -ERROR@9526: expected command, found COMMA -ERROR@9529: expected command, found JSON_ARRAYAGG_KW -ERROR@9542: expected command, found L_PAREN -ERROR@9543: expected command, found IDENT -ERROR@9546: expected command, found R_PAREN -ERROR@9548: expected command, found AS_KW -ERROR@9551: expected command, found IDENT -ERROR@9565: expected command, found COMMA -ERROR@9568: expected command, found JSON_ARRAYAGG_KW -ERROR@9581: expected command, found L_PAREN -ERROR@9582: expected command, found IDENT -ERROR@9586: expected command, found RETURNING_KW -ERROR@9596: expected command, found IDENT -ERROR@9601: expected command, found R_PAREN -ERROR@9603: expected command, found AS_KW -ERROR@9606: expected command, found IDENT -ERROR@9625: expected command, found COMMA -ERROR@9628: expected command, found JSON_ARRAYAGG_KW -ERROR@9641: expected command, found L_PAREN -ERROR@9642: expected command, found IDENT -ERROR@9646: expected command, found ORDER_KW -ERROR@9652: expected command, found BY_KW -ERROR@9655: expected command, found IDENT -ERROR@9658: expected command, found R_PAREN -ERROR@9660: expected command, found FILTER_KW -ERROR@9667: expected command, found L_PAREN -ERROR@9668: expected command, found WHERE_KW -ERROR@9674: expected command, found IDENT -ERROR@9678: expected command, found R_ANGLE -ERROR@9680: expected command, found INT_NUMBER -ERROR@9681: expected command, found R_PAREN -ERROR@9683: expected command, found AS_KW -ERROR@9686: expected command, found IDENT -ERROR@9702: expected command, found COMMA -ERROR@9705: expected command, found JSON_ARRAYAGG_KW -ERROR@9718: expected command, found L_PAREN -ERROR@9719: expected command, found IDENT -ERROR@9723: expected command, found ORDER_KW -ERROR@9729: expected command, found BY_KW -ERROR@9732: expected command, found IDENT -ERROR@9736: expected command, found RETURNING_KW -ERROR@9746: expected command, found IDENT -ERROR@9751: expected command, found R_PAREN -ERROR@9753: expected command, found FILTER_KW -ERROR@9760: expected command, found L_PAREN -ERROR@9761: expected command, found WHERE_KW -ERROR@9767: expected command, found IDENT -ERROR@9771: expected command, found R_ANGLE -ERROR@9773: expected command, found INT_NUMBER -ERROR@9774: expected command, found R_PAREN -ERROR@9776: expected command, found AS_KW -ERROR@9779: expected command, found IDENT -ERROR@9812: expected command, found FROM_KW -ERROR@9818: expected command, found L_PAREN -ERROR@9881: expected SEMICOLON -ERROR@9881: expected command, found R_PAREN -ERROR@9883: expected command, found IDENT -ERROR@9886: expected command, found L_PAREN -ERROR@9887: expected command, found IDENT -ERROR@9890: expected command, found R_PAREN -ERROR@10120: expected R_PAREN -ERROR@10120: expected SEMICOLON -ERROR@10120: expected command, found COLON -ERROR@10122: expected command, found INT_NUMBER -ERROR@10123: expected command, found R_PAREN -ERROR@10125: expected command, found IS_KW -ERROR@10128: expected command, found NULL_KW -ERROR@10132: expected command, found COMMA -ERROR@10136: expected command, found JSON_OBJECTAGG_KW -ERROR@10150: expected command, found L_PAREN -ERROR@10151: expected command, found STRING -ERROR@10156: expected command, found COLON -ERROR@10158: expected command, found INT_NUMBER -ERROR@10160: expected command, found RETURNING_KW -ERROR@10170: expected command, found IDENT -ERROR@10175: expected command, found R_PAREN -ERROR@10177: expected command, found IS_KW -ERROR@10180: expected command, found NULL_KW -ERROR@10185: expected command, found WHERE_KW -ERROR@10191: expected command, found FALSE_KW -ERROR@10225: expected R_PAREN -ERROR@10225: expected SEMICOLON -ERROR@10225: expected command, found COLON -ERROR@10227: expected command, found INT_NUMBER -ERROR@10228: expected command, found R_PAREN -ERROR@10258: expected R_PAREN -ERROR@10258: expected SEMICOLON -ERROR@10258: expected command, found COLON -ERROR@10260: expected command, found INT_NUMBER -ERROR@10262: expected command, found RETURNING_KW -ERROR@10272: expected command, found IDENT -ERROR@10277: expected command, found R_PAREN -ERROR@10305: expected R_PAREN -ERROR@10305: expected SEMICOLON -ERROR@10305: expected command, found COLON -ERROR@10307: expected command, found IDENT -ERROR@10308: expected command, found R_PAREN -ERROR@10309: expected command, found COMMA -ERROR@10376: expected command, found JSON_OBJECTAGG_KW -ERROR@10390: expected command, found L_PAREN -ERROR@10391: expected command, found IDENT -ERROR@10392: expected command, found COLON -ERROR@10394: expected command, found IDENT -ERROR@10396: expected command, found RETURNING_KW -ERROR@10406: expected command, found IDENT -ERROR@10411: expected command, found R_PAREN -ERROR@10413: expected command, found FROM_KW -ERROR@10419: expected command, found IDENT -ERROR@10434: expected command, found L_PAREN -ERROR@10435: expected command, found INT_NUMBER -ERROR@10436: expected command, found COMMA -ERROR@10438: expected command, found INT_NUMBER -ERROR@10439: expected command, found R_PAREN -ERROR@10441: expected command, found IDENT -ERROR@10469: expected R_PAREN -ERROR@10469: expected SEMICOLON -ERROR@10469: expected command, found COLON -ERROR@10471: expected command, found IDENT -ERROR@10472: expected command, found R_PAREN -ERROR@10473: expected command, found COMMA -ERROR@10476: expected command, found JSON_OBJECTAGG_KW -ERROR@10490: expected command, found L_PAREN -ERROR@10491: expected command, found IDENT -ERROR@10492: expected command, found COLON -ERROR@10494: expected command, found IDENT -ERROR@10496: expected command, found NULL_KW -ERROR@10501: expected command, found ON_KW -ERROR@10504: expected command, found NULL_KW -ERROR@10508: expected command, found R_PAREN -ERROR@10509: expected command, found COMMA -ERROR@10512: expected command, found JSON_OBJECTAGG_KW -ERROR@10526: expected command, found L_PAREN -ERROR@10527: expected command, found IDENT -ERROR@10528: expected command, found COLON -ERROR@10530: expected command, found IDENT -ERROR@10532: expected command, found ABSENT_KW -ERROR@10539: expected command, found ON_KW -ERROR@10542: expected command, found NULL_KW -ERROR@10546: expected command, found R_PAREN -ERROR@10547: expected command, found COMMA -ERROR@10550: expected command, found JSON_OBJECTAGG_KW -ERROR@10564: expected command, found L_PAREN -ERROR@10565: expected command, found IDENT -ERROR@10566: expected command, found COLON -ERROR@10568: expected command, found IDENT -ERROR@10570: expected command, found RETURNING_KW -ERROR@10580: expected command, found IDENT -ERROR@10585: expected command, found R_PAREN -ERROR@10586: expected command, found COMMA -ERROR@10589: expected command, found JSON_OBJECTAGG_KW -ERROR@10603: expected command, found L_PAREN -ERROR@10604: expected command, found IDENT -ERROR@10605: expected command, found COLON -ERROR@10607: expected command, found IDENT -ERROR@10609: expected command, found NULL_KW -ERROR@10614: expected command, found ON_KW -ERROR@10617: expected command, found NULL_KW -ERROR@10622: expected command, found RETURNING_KW -ERROR@10632: expected command, found IDENT -ERROR@10637: expected command, found R_PAREN -ERROR@10638: expected command, found COMMA -ERROR@10641: expected command, found JSON_OBJECTAGG_KW -ERROR@10655: expected command, found L_PAREN -ERROR@10656: expected command, found IDENT -ERROR@10657: expected command, found COLON -ERROR@10659: expected command, found IDENT -ERROR@10661: expected command, found ABSENT_KW -ERROR@10668: expected command, found ON_KW -ERROR@10671: expected command, found NULL_KW -ERROR@10676: expected command, found RETURNING_KW -ERROR@10686: expected command, found IDENT -ERROR@10691: expected command, found R_PAREN -ERROR@10693: expected command, found FROM_KW -ERROR@10699: expected command, found L_PAREN -ERROR@10743: expected SEMICOLON -ERROR@10743: expected command, found R_PAREN -ERROR@10745: expected command, found IDENT -ERROR@10748: expected command, found L_PAREN -ERROR@10749: expected command, found IDENT -ERROR@10750: expected command, found COMMA -ERROR@10752: expected command, found IDENT -ERROR@10753: expected command, found R_PAREN -ERROR@10780: expected R_PAREN -ERROR@10780: expected SEMICOLON -ERROR@10780: expected command, found COLON -ERROR@10782: expected command, found IDENT -ERROR@10789: expected name -ERROR@10789: expected AS_KW -ERROR@10789: expected L_PAREN -ERROR@10789: expected command, found UNIQUE_KW -ERROR@10795: expected SELECT, TABLE, VALUES, INSERT, UPDATE, DELETE, or MERGE statement -ERROR@10795: expected R_PAREN -ERROR@10795: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: KEYS_KW -ERROR@10796: expected command, found KEYS_KW -ERROR@10800: expected command, found R_PAREN -ERROR@10802: expected command, found FROM_KW -ERROR@10807: expected command, found L_PAREN -ERROR@10840: expected SEMICOLON -ERROR@10840: expected command, found R_PAREN -ERROR@10842: expected command, found IDENT -ERROR@10845: expected command, found L_PAREN -ERROR@10846: expected command, found IDENT -ERROR@10847: expected command, found COMMA -ERROR@10849: expected command, found IDENT -ERROR@10850: expected command, found R_PAREN -ERROR@10877: expected R_PAREN -ERROR@10877: expected SEMICOLON -ERROR@10877: expected command, found COLON -ERROR@10879: expected command, found IDENT -ERROR@10881: expected command, found ABSENT_KW -ERROR@10888: expected command, found ON_KW -ERROR@10891: expected command, found NULL_KW -ERROR@10901: expected name -ERROR@10901: expected AS_KW -ERROR@10901: expected L_PAREN -ERROR@10901: expected command, found UNIQUE_KW -ERROR@10907: expected SELECT, TABLE, VALUES, INSERT, UPDATE, DELETE, or MERGE statement -ERROR@10907: expected R_PAREN -ERROR@10907: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: KEYS_KW -ERROR@10908: expected command, found KEYS_KW -ERROR@10912: expected command, found R_PAREN -ERROR@10914: expected command, found FROM_KW -ERROR@10919: expected command, found L_PAREN -ERROR@10952: expected SEMICOLON -ERROR@10952: expected command, found R_PAREN -ERROR@10954: expected command, found IDENT -ERROR@10957: expected command, found L_PAREN -ERROR@10958: expected command, found IDENT -ERROR@10959: expected command, found COMMA -ERROR@10961: expected command, found IDENT -ERROR@10962: expected command, found R_PAREN -ERROR@10989: expected R_PAREN -ERROR@10989: expected SEMICOLON -ERROR@10989: expected command, found COLON -ERROR@10991: expected command, found IDENT -ERROR@10993: expected command, found ABSENT_KW -ERROR@11000: expected command, found ON_KW -ERROR@11003: expected command, found NULL_KW -ERROR@11013: expected name -ERROR@11013: expected AS_KW -ERROR@11013: expected L_PAREN -ERROR@11013: expected command, found UNIQUE_KW -ERROR@11019: expected SELECT, TABLE, VALUES, INSERT, UPDATE, DELETE, or MERGE statement -ERROR@11019: expected R_PAREN -ERROR@11019: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: KEYS_KW -ERROR@11020: expected command, found KEYS_KW -ERROR@11024: expected command, found R_PAREN -ERROR@11026: expected command, found FROM_KW -ERROR@11031: expected command, found L_PAREN -ERROR@11086: expected SEMICOLON -ERROR@11086: expected command, found R_PAREN -ERROR@11088: expected command, found IDENT -ERROR@11091: expected command, found L_PAREN -ERROR@11092: expected command, found IDENT -ERROR@11093: expected command, found COMMA -ERROR@11095: expected command, found IDENT -ERROR@11096: expected command, found R_PAREN -ERROR@11123: expected R_PAREN -ERROR@11123: expected SEMICOLON -ERROR@11123: expected command, found COLON -ERROR@11125: expected command, found IDENT -ERROR@11132: expected name -ERROR@11132: expected AS_KW -ERROR@11132: expected L_PAREN -ERROR@11132: expected command, found UNIQUE_KW -ERROR@11138: expected SELECT, TABLE, VALUES, INSERT, UPDATE, DELETE, or MERGE statement -ERROR@11138: expected R_PAREN -ERROR@11138: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: KEYS_KW -ERROR@11139: expected command, found KEYS_KW -ERROR@11144: expected command, found RETURNING_KW -ERROR@11154: expected command, found IDENT -ERROR@11159: expected command, found R_PAREN -ERROR@11161: expected command, found FROM_KW -ERROR@11166: expected command, found L_PAREN -ERROR@11199: expected SEMICOLON -ERROR@11199: expected command, found R_PAREN -ERROR@11201: expected command, found IDENT -ERROR@11204: expected command, found L_PAREN -ERROR@11205: expected command, found IDENT -ERROR@11206: expected command, found COMMA -ERROR@11208: expected command, found IDENT -ERROR@11209: expected command, found R_PAREN -ERROR@11236: expected R_PAREN -ERROR@11236: expected SEMICOLON -ERROR@11236: expected command, found COLON -ERROR@11238: expected command, found IDENT -ERROR@11240: expected command, found ABSENT_KW -ERROR@11247: expected command, found ON_KW -ERROR@11250: expected command, found NULL_KW -ERROR@11260: expected name -ERROR@11260: expected AS_KW -ERROR@11260: expected L_PAREN -ERROR@11260: expected command, found UNIQUE_KW -ERROR@11266: expected SELECT, TABLE, VALUES, INSERT, UPDATE, DELETE, or MERGE statement -ERROR@11266: expected R_PAREN -ERROR@11266: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: KEYS_KW -ERROR@11267: expected command, found KEYS_KW -ERROR@11272: expected command, found RETURNING_KW -ERROR@11282: expected command, found IDENT -ERROR@11287: expected command, found R_PAREN -ERROR@11289: expected command, found FROM_KW -ERROR@11294: expected command, found L_PAREN -ERROR@11327: expected SEMICOLON -ERROR@11327: expected command, found R_PAREN -ERROR@11329: expected command, found IDENT -ERROR@11332: expected command, found L_PAREN -ERROR@11333: expected command, found IDENT -ERROR@11334: expected command, found COMMA -ERROR@11336: expected command, found IDENT -ERROR@11337: expected command, found R_PAREN -ERROR@11364: expected R_PAREN -ERROR@11364: expected SEMICOLON -ERROR@11364: expected command, found COLON -ERROR@11366: expected command, found IDENT -ERROR@11368: expected command, found ABSENT_KW -ERROR@11375: expected command, found ON_KW -ERROR@11378: expected command, found NULL_KW -ERROR@11388: expected name -ERROR@11388: expected AS_KW -ERROR@11388: expected L_PAREN -ERROR@11388: expected command, found UNIQUE_KW -ERROR@11394: expected SELECT, TABLE, VALUES, INSERT, UPDATE, DELETE, or MERGE statement -ERROR@11394: expected R_PAREN -ERROR@11394: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: KEYS_KW -ERROR@11395: expected command, found KEYS_KW -ERROR@11400: expected command, found RETURNING_KW -ERROR@11410: expected command, found IDENT -ERROR@11415: expected command, found R_PAREN -ERROR@11417: expected command, found FROM_KW -ERROR@11422: expected command, found L_PAREN -ERROR@11485: expected SEMICOLON -ERROR@11485: expected command, found R_PAREN -ERROR@11487: expected command, found IDENT -ERROR@11490: expected command, found L_PAREN -ERROR@11491: expected command, found IDENT -ERROR@11492: expected command, found COMMA -ERROR@11494: expected command, found IDENT -ERROR@11495: expected command, found R_PAREN -ERROR@11531: expected R_PAREN -ERROR@11531: expected SEMICOLON -ERROR@11531: expected command, found COLON -ERROR@11533: expected command, found L_PAREN -ERROR@11534: expected command, found IDENT -ERROR@11535: expected command, found R_PAREN -ERROR@11536: expected command, found COLON -ERROR@11537: expected command, found COLON -ERROR@11538: expected command, found TEXT_KW -ERROR@11543: expected command, found FORMAT_KW -ERROR@11550: expected command, found JSON_KW -ERROR@11560: expected name -ERROR@11560: expected AS_KW -ERROR@11560: expected L_PAREN -ERROR@11560: expected command, found UNIQUE_KW -ERROR@11566: expected SELECT, TABLE, VALUES, INSERT, UPDATE, DELETE, or MERGE statement -ERROR@11567: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: FROM_KW -ERROR@11568: expected command, found FROM_KW -ERROR@11573: expected command, found IDENT -ERROR@11588: expected command, found L_PAREN -ERROR@11589: expected command, found INT_NUMBER -ERROR@11590: expected command, found COMMA -ERROR@11592: expected command, found INT_NUMBER -ERROR@11595: expected command, found R_PAREN -ERROR@11597: expected command, found IDENT -ERROR@11914: expected R_PAREN -ERROR@11914: expected SEMICOLON -ERROR@11915: expected command, found COLON -ERROR@11917: expected command, found IDENT -ERROR@11924: expected name -ERROR@11924: expected AS_KW -ERROR@11924: expected L_PAREN -ERROR@11924: expected command, found UNIQUE_KW -ERROR@11930: expected SELECT, TABLE, VALUES, INSERT, UPDATE, DELETE, or MERGE statement -ERROR@11930: expected R_PAREN -ERROR@11930: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: KEYS_KW -ERROR@11931: expected command, found KEYS_KW -ERROR@11935: expected command, found R_PAREN -ERROR@11937: expected command, found OVER_KW -ERROR@11942: expected command, found L_PAREN -ERROR@11943: expected command, found ORDER_KW -ERROR@11949: expected command, found BY_KW -ERROR@11952: expected command, found IDENT -ERROR@11953: expected command, found R_PAREN -ERROR@11955: expected command, found FROM_KW -ERROR@11960: expected command, found L_PAREN -ERROR@11980: expected SEMICOLON -ERROR@11980: expected command, found R_PAREN -ERROR@11982: expected command, found IDENT -ERROR@11983: expected command, found L_PAREN -ERROR@11984: expected command, found IDENT -ERROR@11985: expected command, found COMMA -ERROR@11986: expected command, found IDENT -ERROR@11987: expected command, found R_PAREN -ERROR@12031: expected R_PAREN -ERROR@12031: expected SEMICOLON -ERROR@12032: expected command, found COLON -ERROR@12034: expected command, found IDENT -ERROR@12041: expected name -ERROR@12041: expected AS_KW -ERROR@12041: expected L_PAREN -ERROR@12041: expected command, found UNIQUE_KW -ERROR@12047: expected SELECT, TABLE, VALUES, INSERT, UPDATE, DELETE, or MERGE statement -ERROR@12047: expected R_PAREN -ERROR@12047: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: KEYS_KW -ERROR@12048: expected command, found KEYS_KW -ERROR@12052: expected command, found R_PAREN -ERROR@12054: expected command, found OVER_KW -ERROR@12059: expected command, found L_PAREN -ERROR@12060: expected command, found ORDER_KW -ERROR@12066: expected command, found BY_KW -ERROR@12069: expected command, found IDENT -ERROR@12070: expected command, found R_PAREN -ERROR@12072: expected command, found FROM_KW -ERROR@12077: expected command, found L_PAREN -ERROR@12104: expected SEMICOLON -ERROR@12104: expected command, found R_PAREN -ERROR@12106: expected command, found IDENT -ERROR@12107: expected command, found L_PAREN -ERROR@12108: expected command, found IDENT -ERROR@12109: expected command, found COMMA -ERROR@12110: expected command, found IDENT -ERROR@12111: expected command, found R_PAREN -ERROR@12155: expected R_PAREN -ERROR@12155: expected SEMICOLON -ERROR@12156: expected command, found COLON -ERROR@12158: expected command, found IDENT -ERROR@12160: expected command, found ABSENT_KW -ERROR@12167: expected command, found ON_KW -ERROR@12170: expected command, found NULL_KW -ERROR@12180: expected name -ERROR@12180: expected AS_KW -ERROR@12180: expected L_PAREN -ERROR@12180: expected command, found UNIQUE_KW -ERROR@12186: expected SELECT, TABLE, VALUES, INSERT, UPDATE, DELETE, or MERGE statement -ERROR@12186: expected R_PAREN -ERROR@12186: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: KEYS_KW -ERROR@12187: expected command, found KEYS_KW -ERROR@12191: expected command, found R_PAREN -ERROR@12196: expected command, found OVER_KW -ERROR@12201: expected command, found L_PAREN -ERROR@12202: expected command, found ORDER_KW -ERROR@12208: expected command, found BY_KW -ERROR@12211: expected command, found IDENT -ERROR@12212: expected command, found R_PAREN -ERROR@12214: expected command, found FROM_KW -ERROR@12219: expected command, found L_PAREN -ERROR@12249: expected SEMICOLON -ERROR@12249: expected command, found R_PAREN -ERROR@12251: expected command, found IDENT -ERROR@12252: expected command, found L_PAREN -ERROR@12253: expected command, found IDENT -ERROR@12254: expected command, found COMMA -ERROR@12255: expected command, found IDENT -ERROR@12256: expected command, found R_PAREN -ERROR@12300: expected R_PAREN -ERROR@12300: expected SEMICOLON -ERROR@12301: expected command, found COLON -ERROR@12303: expected command, found IDENT -ERROR@12305: expected command, found ABSENT_KW -ERROR@12312: expected command, found ON_KW -ERROR@12315: expected command, found NULL_KW -ERROR@12319: expected command, found R_PAREN -ERROR@12321: expected command, found OVER_KW -ERROR@12326: expected command, found L_PAREN -ERROR@12327: expected command, found ORDER_KW -ERROR@12333: expected command, found BY_KW -ERROR@12336: expected command, found IDENT -ERROR@12337: expected command, found R_PAREN -ERROR@12339: expected command, found FROM_KW -ERROR@12344: expected command, found L_PAREN -ERROR@12374: expected SEMICOLON -ERROR@12374: expected command, found R_PAREN -ERROR@12376: expected command, found IDENT -ERROR@12377: expected command, found L_PAREN -ERROR@12378: expected command, found IDENT -ERROR@12379: expected command, found COMMA -ERROR@12380: expected command, found IDENT -ERROR@12381: expected command, found R_PAREN -ERROR@12425: expected R_PAREN -ERROR@12425: expected SEMICOLON -ERROR@12426: expected command, found COLON -ERROR@12428: expected command, found IDENT -ERROR@12430: expected command, found ABSENT_KW -ERROR@12437: expected command, found ON_KW -ERROR@12440: expected command, found NULL_KW -ERROR@12444: expected command, found R_PAREN -ERROR@12446: expected command, found OVER_KW -ERROR@12451: expected command, found L_PAREN -ERROR@12452: expected command, found ORDER_KW -ERROR@12458: expected command, found BY_KW -ERROR@12461: expected command, found IDENT -ERROR@12463: expected command, found RANGE_KW -ERROR@12469: expected command, found BETWEEN_KW -ERROR@12477: expected command, found UNBOUNDED_KW -ERROR@12487: expected command, found PRECEDING_KW -ERROR@12497: expected command, found AND_KW -ERROR@12501: expected command, found UNBOUNDED_KW -ERROR@12511: expected command, found FOLLOWING_KW -ERROR@12520: expected command, found R_PAREN -ERROR@12522: expected command, found FROM_KW -ERROR@12527: expected command, found L_PAREN -ERROR@12557: expected SEMICOLON -ERROR@12557: expected command, found R_PAREN -ERROR@12559: expected command, found IDENT -ERROR@12560: expected command, found L_PAREN -ERROR@12561: expected command, found IDENT -ERROR@12562: expected command, found COMMA -ERROR@12563: expected command, found IDENT -ERROR@12564: expected command, found R_PAREN -ERROR@12881: expected R_PAREN -ERROR@12881: expected SEMICOLON -ERROR@12881: expected command, found COLON -ERROR@12883: expected command, found L_PAREN -ERROR@12884: expected command, found STRING -ERROR@12890: expected command, found PIPE -ERROR@12891: expected command, found PIPE -ERROR@12893: expected command, found IDENT -ERROR@12894: expected command, found R_PAREN -ERROR@12895: expected command, found COLON -ERROR@12896: expected command, found COLON -ERROR@12897: expected command, found IDENT -ERROR@12903: expected command, found FORMAT_KW -ERROR@12910: expected command, found JSON_KW -ERROR@12920: expected name -ERROR@12920: expected AS_KW -ERROR@12920: expected L_PAREN -ERROR@12920: expected command, found UNIQUE_KW -ERROR@12926: expected SELECT, TABLE, VALUES, INSERT, UPDATE, DELETE, or MERGE statement -ERROR@12926: expected R_PAREN -ERROR@12926: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: RETURNING_KW -ERROR@12927: expected command, found RETURNING_KW -ERROR@12937: expected command, found TEXT_KW -ERROR@12941: expected command, found R_PAREN -ERROR@12943: expected command, found FILTER_KW -ERROR@12950: expected command, found L_PAREN -ERROR@12951: expected command, found WHERE_KW -ERROR@12957: expected command, found IDENT -ERROR@12959: expected command, found R_ANGLE -ERROR@12961: expected command, found INT_NUMBER -ERROR@12962: expected command, found R_PAREN -ERROR@12964: expected command, found FROM_KW -ERROR@12969: expected command, found IDENT -ERROR@12984: expected command, found L_PAREN -ERROR@12985: expected command, found INT_NUMBER -ERROR@12986: expected command, found COMMA -ERROR@12987: expected command, found INT_NUMBER -ERROR@12988: expected command, found R_PAREN -ERROR@12990: expected command, found IDENT -ERROR@13046: expected R_PAREN -ERROR@13046: expected SEMICOLON -ERROR@13046: expected command, found COLON -ERROR@13048: expected command, found L_PAREN -ERROR@13049: expected command, found STRING -ERROR@13055: expected command, found PIPE -ERROR@13056: expected command, found PIPE -ERROR@13058: expected command, found IDENT -ERROR@13059: expected command, found R_PAREN -ERROR@13060: expected command, found COLON -ERROR@13061: expected command, found COLON -ERROR@13062: expected command, found IDENT -ERROR@13068: expected command, found FORMAT_KW -ERROR@13075: expected command, found JSON_KW -ERROR@13085: expected name -ERROR@13085: expected AS_KW -ERROR@13085: expected L_PAREN -ERROR@13085: expected command, found UNIQUE_KW -ERROR@13091: expected SELECT, TABLE, VALUES, INSERT, UPDATE, DELETE, or MERGE statement -ERROR@13091: expected R_PAREN -ERROR@13091: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: RETURNING_KW -ERROR@13092: expected command, found RETURNING_KW -ERROR@13102: expected command, found TEXT_KW -ERROR@13106: expected command, found R_PAREN -ERROR@13108: expected command, found OVER_KW -ERROR@13113: expected command, found L_PAREN -ERROR@13114: expected command, found PARTITION_KW -ERROR@13124: expected command, found BY_KW -ERROR@13127: expected command, found IDENT -ERROR@13129: expected command, found PERCENT -ERROR@13131: expected command, found INT_NUMBER -ERROR@13132: expected command, found R_PAREN -ERROR@13134: expected command, found FROM_KW -ERROR@13139: expected command, found IDENT -ERROR@13154: expected command, found L_PAREN -ERROR@13155: expected command, found INT_NUMBER -ERROR@13156: expected command, found COMMA -ERROR@13157: expected command, found INT_NUMBER -ERROR@13158: expected command, found R_PAREN -ERROR@13160: expected command, found IDENT -ERROR@13222: expected R_PAREN -ERROR@13222: expected SEMICOLON -ERROR@13222: expected command, found COLON -ERROR@13224: expected command, found L_PAREN -ERROR@13225: expected command, found STRING -ERROR@13231: expected command, found PIPE -ERROR@13232: expected command, found PIPE -ERROR@13234: expected command, found IDENT -ERROR@13235: expected command, found R_PAREN -ERROR@13236: expected command, found COLON -ERROR@13237: expected command, found COLON -ERROR@13238: expected command, found IDENT -ERROR@13244: expected command, found FORMAT_KW -ERROR@13251: expected command, found JSON_KW -ERROR@13261: expected name -ERROR@13261: expected AS_KW -ERROR@13261: expected L_PAREN -ERROR@13261: expected command, found UNIQUE_KW -ERROR@13267: expected SELECT, TABLE, VALUES, INSERT, UPDATE, DELETE, or MERGE statement -ERROR@13267: expected R_PAREN -ERROR@13267: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: RETURNING_KW -ERROR@13268: expected command, found RETURNING_KW -ERROR@13278: expected command, found TEXT_KW -ERROR@13282: expected command, found R_PAREN -ERROR@13284: expected command, found FILTER_KW -ERROR@13291: expected command, found L_PAREN -ERROR@13292: expected command, found WHERE_KW -ERROR@13298: expected command, found IDENT -ERROR@13300: expected command, found R_ANGLE -ERROR@13302: expected command, found INT_NUMBER -ERROR@13303: expected command, found R_PAREN -ERROR@13305: expected command, found FROM_KW -ERROR@13310: expected command, found IDENT -ERROR@13325: expected command, found L_PAREN -ERROR@13326: expected command, found INT_NUMBER -ERROR@13327: expected command, found COMMA -ERROR@13328: expected command, found INT_NUMBER -ERROR@13329: expected command, found R_PAREN -ERROR@13331: expected command, found IDENT -ERROR@13469: expected COMMA -ERROR@13476: expected COMMA -ERROR@13481: expected COMMA -ERROR@13486: expected R_PAREN -ERROR@13486: expected SEMICOLON -ERROR@13487: expected command, found ON_KW -ERROR@13490: expected command, found NULL_KW -ERROR@13495: expected command, found RETURNING_KW -ERROR@13505: expected command, found TEXT_KW -ERROR@13509: expected command, found R_PAREN -ERROR@13511: expected command, found FILTER_KW -ERROR@13518: expected command, found L_PAREN -ERROR@13519: expected command, found WHERE_KW -ERROR@13525: expected command, found IDENT -ERROR@13527: expected command, found R_ANGLE -ERROR@13529: expected command, found INT_NUMBER -ERROR@13530: expected command, found R_PAREN -ERROR@13532: expected command, found FROM_KW -ERROR@13537: expected command, found IDENT -ERROR@13552: expected command, found L_PAREN -ERROR@13553: expected command, found INT_NUMBER -ERROR@13554: expected command, found COMMA -ERROR@13555: expected command, found INT_NUMBER -ERROR@13556: expected command, found R_PAREN -ERROR@13558: expected command, found IDENT -ERROR@13631: expected COMMA -ERROR@13638: expected COMMA -ERROR@13643: expected COMMA -ERROR@13648: expected R_PAREN -ERROR@13648: expected SEMICOLON -ERROR@13649: expected command, found ON_KW -ERROR@13652: expected command, found NULL_KW -ERROR@13657: expected command, found RETURNING_KW -ERROR@13667: expected command, found TEXT_KW -ERROR@13671: expected command, found R_PAREN -ERROR@13673: expected command, found OVER_KW -ERROR@13678: expected command, found L_PAREN -ERROR@13679: expected command, found PARTITION_KW -ERROR@13689: expected command, found BY_KW -ERROR@13692: expected command, found IDENT -ERROR@13694: expected command, found PERCENT -ERROR@13696: expected command, found INT_NUMBER -ERROR@13697: expected command, found R_PAREN -ERROR@13699: expected command, found FROM_KW -ERROR@13704: expected command, found IDENT -ERROR@13719: expected command, found L_PAREN -ERROR@13720: expected command, found INT_NUMBER -ERROR@13721: expected command, found COMMA -ERROR@13722: expected command, found INT_NUMBER -ERROR@13723: expected command, found R_PAREN -ERROR@13725: expected command, found IDENT -ERROR@13803: expected COMMA -ERROR@13810: expected COMMA -ERROR@13815: expected COMMA -ERROR@13820: expected R_PAREN -ERROR@13820: expected SEMICOLON -ERROR@13821: expected command, found ON_KW -ERROR@13824: expected command, found NULL_KW -ERROR@13829: expected command, found RETURNING_KW -ERROR@13839: expected command, found TEXT_KW -ERROR@13843: expected command, found R_PAREN -ERROR@13845: expected command, found FILTER_KW -ERROR@13852: expected command, found L_PAREN -ERROR@13853: expected command, found WHERE_KW -ERROR@13859: expected command, found IDENT -ERROR@13861: expected command, found R_ANGLE -ERROR@13863: expected command, found INT_NUMBER -ERROR@13864: expected command, found R_PAREN -ERROR@13866: expected command, found FROM_KW -ERROR@13871: expected command, found IDENT -ERROR@13886: expected command, found L_PAREN -ERROR@13887: expected command, found INT_NUMBER -ERROR@13888: expected command, found COMMA -ERROR@13889: expected command, found INT_NUMBER -ERROR@13890: expected command, found R_PAREN -ERROR@13892: expected command, found IDENT -ERROR@14949: missing comma -ERROR@14980: missing comma -ERROR@15005: missing comma -ERROR@15006: expected expression in atom_expr -ERROR@15011: expected an expression in target_el, found IDENT -ERROR@15042: missing comma -ERROR@15067: missing comma -ERROR@15082: missing comma -ERROR@15117: expected SEMICOLON -ERROR@15123: expected name -ERROR@15123: expected AS_KW -ERROR@15123: expected L_PAREN -ERROR@15123: expected command, found UNIQUE_KW -ERROR@15129: expected SELECT, TABLE, VALUES, INSERT, UPDATE, DELETE, or MERGE statement -ERROR@15129: expected R_PAREN -ERROR@15129: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: KEYS_KW -ERROR@15130: expected command, found KEYS_KW -ERROR@15135: expected command, found IDENT -ERROR@15149: expected command, found FROM_KW -ERROR@15155: expected command, found IDENT -ERROR@15253: missing comma -ERROR@15284: missing comma -ERROR@15309: missing comma -ERROR@15310: expected expression in atom_expr -ERROR@15315: expected an expression in target_el, found IDENT -ERROR@15346: missing comma -ERROR@15371: missing comma -ERROR@15386: missing comma -ERROR@15421: expected SEMICOLON -ERROR@15427: expected name -ERROR@15427: expected AS_KW -ERROR@15427: expected L_PAREN -ERROR@15427: expected command, found UNIQUE_KW -ERROR@15433: expected SELECT, TABLE, VALUES, INSERT, UPDATE, DELETE, or MERGE statement -ERROR@15433: expected R_PAREN -ERROR@15433: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: KEYS_KW -ERROR@15434: expected command, found KEYS_KW -ERROR@15439: expected command, found IDENT -ERROR@15453: expected command, found FROM_KW -ERROR@15511: expected SEMICOLON -ERROR@15512: expected command, found IDENT -ERROR@15515: expected command, found L_PAREN -ERROR@15516: expected command, found IDENT -ERROR@15518: expected command, found R_PAREN -ERROR@15606: missing comma -ERROR@15637: missing comma -ERROR@15662: missing comma -ERROR@15663: expected expression in atom_expr -ERROR@15668: expected an expression in target_el, found IDENT -ERROR@15699: missing comma -ERROR@15724: missing comma -ERROR@15739: missing comma -ERROR@15774: expected SEMICOLON -ERROR@15780: expected name -ERROR@15780: expected AS_KW -ERROR@15780: expected L_PAREN -ERROR@15780: expected command, found UNIQUE_KW -ERROR@15786: expected SELECT, TABLE, VALUES, INSERT, UPDATE, DELETE, or MERGE statement -ERROR@15786: expected R_PAREN -ERROR@15786: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: KEYS_KW -ERROR@15787: expected command, found KEYS_KW -ERROR@15792: expected command, found IDENT -ERROR@15806: expected command, found FROM_KW -ERROR@15869: expected SEMICOLON -ERROR@15870: expected command, found IDENT -ERROR@15873: expected command, found L_PAREN -ERROR@15874: expected command, found IDENT -ERROR@15877: expected command, found COMMA -ERROR@15879: expected command, found IDENT -ERROR@15881: expected command, found R_PAREN -ERROR@15968: missing comma -ERROR@15999: missing comma -ERROR@16024: missing comma -ERROR@16025: expected expression in atom_expr -ERROR@16030: expected an expression in target_el, found IDENT -ERROR@16061: missing comma -ERROR@16086: missing comma -ERROR@16101: missing comma -ERROR@16136: expected SEMICOLON -ERROR@16142: expected name -ERROR@16142: expected AS_KW -ERROR@16142: expected L_PAREN -ERROR@16142: expected command, found UNIQUE_KW -ERROR@16148: expected SELECT, TABLE, VALUES, INSERT, UPDATE, DELETE, or MERGE statement -ERROR@16148: expected R_PAREN -ERROR@16148: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: KEYS_KW -ERROR@16149: expected command, found KEYS_KW -ERROR@16154: expected command, found IDENT -ERROR@16168: expected command, found FROM_KW -ERROR@16227: expected SEMICOLON -ERROR@16228: expected command, found IDENT -ERROR@16231: expected command, found L_PAREN -ERROR@16232: expected command, found IDENT -ERROR@16234: expected command, found R_PAREN -ERROR@16347: expected SEMICOLON -ERROR@16348: expected command, found AS_KW -ERROR@16351: expected command, found IDENT -ERROR@16359: expected command, found COMMA -ERROR@16361: expected command, found STRING -ERROR@16366: expected command, found IS_KW -ERROR@16369: expected command, found NOT_KW -ERROR@16373: expected command, found JSON_KW -ERROR@16378: expected command, found ARRAY_KW -ERROR@16384: expected command, found AS_KW -ERROR@16387: expected command, found IDENT -ERROR@16394: expected command, found COMMA -ERROR@16396: expected command, found STRING -ERROR@16401: expected command, found IS_KW -ERROR@16404: expected command, found JSON_KW -ERROR@16409: expected command, found OBJECT_KW -ERROR@16421: expected name -ERROR@16421: expected AS_KW -ERROR@16421: expected L_PAREN -ERROR@16421: expected command, found UNIQUE_KW -ERROR@16427: expected SELECT, TABLE, VALUES, INSERT, UPDATE, DELETE, or MERGE statement -ERROR@16427: expected R_PAREN -ERROR@16427: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: AS_KW -ERROR@16428: expected command, found AS_KW -ERROR@16431: expected command, found IDENT -ERROR@16440: expected command, found FROM_KW -ERROR@16445: expected command, found IDENT -ERROR@16460: expected command, found L_PAREN -ERROR@16461: expected command, found INT_NUMBER -ERROR@16462: expected command, found COMMA -ERROR@16464: expected command, found INT_NUMBER -ERROR@16465: expected command, found R_PAREN -ERROR@16467: expected command, found IDENT -ERROR@16553: expected SEMICOLON -ERROR@16554: expected command, found AS_KW -ERROR@16557: expected command, found IDENT -ERROR@16565: expected command, found COMMA -ERROR@16567: expected command, found STRING -ERROR@16572: expected command, found IS_KW -ERROR@16575: expected command, found NOT_KW -ERROR@16579: expected command, found JSON_KW -ERROR@16584: expected command, found ARRAY_KW -ERROR@16590: expected command, found AS_KW -ERROR@16593: expected command, found IDENT -ERROR@16600: expected command, found COMMA -ERROR@16602: expected command, found STRING -ERROR@16607: expected command, found IS_KW -ERROR@16610: expected command, found JSON_KW -ERROR@16615: expected command, found OBJECT_KW -ERROR@16627: expected name -ERROR@16627: expected AS_KW -ERROR@16627: expected L_PAREN -ERROR@16627: expected command, found UNIQUE_KW -ERROR@16633: expected SELECT, TABLE, VALUES, INSERT, UPDATE, DELETE, or MERGE statement -ERROR@16633: expected R_PAREN -ERROR@16633: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: AS_KW -ERROR@16634: expected command, found AS_KW -ERROR@16637: expected command, found IDENT -ERROR@16646: expected command, found FROM_KW -ERROR@16651: expected command, found IDENT -ERROR@16666: expected command, found L_PAREN -ERROR@16667: expected command, found INT_NUMBER -ERROR@16668: expected command, found COMMA -ERROR@16670: expected command, found INT_NUMBER -ERROR@16671: expected command, found R_PAREN -ERROR@16673: expected command, found IDENT -ERROR@17011: expected COMMA -ERROR@17018: expected COMMA -ERROR@17023: expected COMMA -ERROR@17028: expected R_PAREN -ERROR@17028: expected SEMICOLON -ERROR@17029: expected command, found ON_KW -ERROR@17032: expected command, found NULL_KW -ERROR@17037: expected command, found RETURNING_KW -ERROR@17047: expected command, found VARCHAR_KW -ERROR@17054: expected command, found L_PAREN -ERROR@17055: expected command, found INT_NUMBER -ERROR@17056: expected command, found R_PAREN -ERROR@17057: expected command, found R_PAREN -ERROR@17059: expected command, found FROM_KW -ERROR@17064: expected command, found IDENT -ERROR@17079: expected command, found L_PAREN -ERROR@17080: expected command, found INT_NUMBER -ERROR@17081: expected command, found COMMA -ERROR@17082: expected command, found INT_NUMBER -ERROR@17083: expected command, found R_PAREN -ERROR@17085: expected command, found IDENT -ERROR@17111: expected R_PAREN -ERROR@17111: expected SEMICOLON -ERROR@17111: expected command, found COLON -ERROR@17113: expected command, found L_PAREN -ERROR@17114: expected command, found STRING -ERROR@17120: expected command, found PIPE -ERROR@17121: expected command, found PIPE -ERROR@17123: expected command, found IDENT -ERROR@17124: expected command, found R_PAREN -ERROR@17125: expected command, found COLON -ERROR@17126: expected command, found COLON -ERROR@17127: expected command, found IDENT -ERROR@17133: expected command, found FORMAT_KW -ERROR@17140: expected command, found JSON_KW -ERROR@17150: expected name -ERROR@17150: expected AS_KW -ERROR@17150: expected L_PAREN -ERROR@17150: expected command, found UNIQUE_KW -ERROR@17156: expected SELECT, TABLE, VALUES, INSERT, UPDATE, DELETE, or MERGE statement -ERROR@17156: expected R_PAREN -ERROR@17156: expected DELETE, SELECT, TABLE, UPDATE, VALUES, or MERGE, got: RETURNING_KW -ERROR@17157: expected command, found RETURNING_KW -ERROR@17167: expected command, found VARCHAR_KW -ERROR@17174: expected command, found L_PAREN -ERROR@17175: expected command, found INT_NUMBER -ERROR@17176: expected command, found R_PAREN -ERROR@17177: expected command, found R_PAREN -ERROR@17179: expected command, found FROM_KW -ERROR@17184: expected command, found IDENT -ERROR@17199: expected command, found L_PAREN -ERROR@17200: expected command, found INT_NUMBER -ERROR@17201: expected command, found COMMA -ERROR@17203: expected command, found INT_NUMBER -ERROR@17204: expected command, found R_PAREN -ERROR@17206: expected command, found IDENT -ERROR@17980: expected R_PAREN -ERROR@18012: expected SEMICOLON -ERROR@18013: expected command, found FORMAT_KW -ERROR@18020: expected command, found JSON_KW -ERROR@18024: expected command, found R_PAREN -ERROR@18069: expected R_PAREN -ERROR@18101: expected SEMICOLON -ERROR@18102: expected command, found FORMAT_KW -ERROR@18109: expected command, found JSON_KW -ERROR@18113: expected command, found R_PAREN -ERROR@18187: expected R_PAREN -ERROR@18217: expected SEMICOLON -ERROR@18218: expected command, found FORMAT_KW -ERROR@18225: expected command, found JSON_KW -ERROR@18229: expected command, found R_PAREN -ERROR@18274: expected R_PAREN -ERROR@18304: expected SEMICOLON -ERROR@18305: expected command, found FORMAT_KW -ERROR@18312: expected command, found JSON_KW -ERROR@18316: expected command, found R_PAREN -ERROR@18390: expected R_PAREN -ERROR@18409: expected SEMICOLON -ERROR@18410: expected command, found FORMAT_KW -ERROR@18417: expected command, found JSON_KW -ERROR@18421: expected command, found R_PAREN -ERROR@18466: expected R_PAREN -ERROR@18485: expected SEMICOLON -ERROR@18486: expected command, found FORMAT_KW -ERROR@18493: expected command, found JSON_KW -ERROR@18497: expected command, found R_PAREN + diff --git a/crates/squawk_parser/tests/snapshots/tests__regression_sqljson_queryfuncs.snap b/crates/squawk_parser/tests/snapshots/tests__regression_sqljson_queryfuncs.snap index dea587ca..9ae52e53 100644 --- a/crates/squawk_parser/tests/snapshots/tests__regression_sqljson_queryfuncs.snap +++ b/crates/squawk_parser/tests/snapshots/tests__regression_sqljson_queryfuncs.snap @@ -2,54 +2,4 @@ source: crates/squawk_parser/tests/tests.rs input_file: crates/squawk_parser/tests/data/regression_suite/sqljson_queryfuncs.sql --- -ERROR@4635: expected json behavior -ERROR@4635: expected ON_KW -ERROR@4635: expected ERROR_KW -ERROR@9001: expected json behavior -ERROR@9001: expected ON_KW -ERROR@9001: expected ERROR_KW -ERROR@9103: expected json behavior -ERROR@9103: expected ON_KW -ERROR@9103: expected ERROR_KW -ERROR@10671: expected json behavior -ERROR@10671: expected ON_KW -ERROR@10671: expected ERROR_KW -ERROR@10725: expected json behavior -ERROR@10725: expected ON_KW -ERROR@10725: expected ERROR_KW -ERROR@10785: expected json behavior -ERROR@10785: expected ON_KW -ERROR@10785: expected ERROR_KW -ERROR@10846: expected json behavior -ERROR@10846: expected ON_KW -ERROR@10846: expected ERROR_KW -ERROR@10900: expected json behavior -ERROR@10900: expected ON_KW -ERROR@10900: expected ERROR_KW -ERROR@10966: expected json behavior -ERROR@10966: expected ON_KW -ERROR@10966: expected ERROR_KW -ERROR@13512: expected json behavior -ERROR@13512: expected ON_KW -ERROR@13512: expected ERROR_KW -ERROR@17030: expected json behavior -ERROR@17030: expected ON_KW -ERROR@17030: expected ERROR_KW -ERROR@22420: expected json behavior -ERROR@22420: expected ON_KW -ERROR@22420: expected ERROR_KW -ERROR@22549: expected json behavior -ERROR@22549: expected ON_KW -ERROR@22549: expected ERROR_KW -ERROR@22669: expected json behavior -ERROR@22669: expected ON_KW -ERROR@22669: expected ERROR_KW -ERROR@22800: expected json behavior -ERROR@22800: expected ON_KW -ERROR@22800: expected ERROR_KW -ERROR@23992: expected json behavior -ERROR@23992: expected ON_KW -ERROR@23992: expected ERROR_KW -ERROR@26935: expected json behavior -ERROR@26935: expected ON_KW -ERROR@26935: expected ERROR_KW + diff --git a/crates/squawk_parser/tests/snapshots/tests__regression_suite_errors.snap b/crates/squawk_parser/tests/snapshots/tests__regression_suite_errors.snap index d1e69d7f..ea81ef7d 100644 --- a/crates/squawk_parser/tests/snapshots/tests__regression_suite_errors.snap +++ b/crates/squawk_parser/tests/snapshots/tests__regression_suite_errors.snap @@ -2,7 +2,6 @@ source: crates/squawk_parser/tests/tests.rs expression: "out.join(\"\\n\")" --- -tests/snapshots/tests__regression_errors.snap:286 tests/snapshots/tests__regression_groupingsets.snap:16 tests/snapshots/tests__regression_inherit.snap:30 tests/snapshots/tests__regression_join.snap:20 @@ -10,17 +9,12 @@ tests/snapshots/tests__regression_merge.snap:250 tests/snapshots/tests__regression_partition_prune.snap:326 tests/snapshots/tests__regression_privileges.snap:84 tests/snapshots/tests__regression_rangefuncs.snap:281 -tests/snapshots/tests__regression_returning.snap:230 -tests/snapshots/tests__regression_rules.snap:26 -tests/snapshots/tests__regression_sqljson.snap:1068 tests/snapshots/tests__regression_sqljson_jsontable.snap:185 -tests/snapshots/tests__regression_sqljson_queryfuncs.snap:51 tests/snapshots/tests__regression_strings.snap:49 tests/snapshots/tests__regression_subselect.snap:44 -tests/snapshots/tests__regression_transactions.snap:114 -tests/snapshots/tests__regression_tuplesort.snap:188 +tests/snapshots/tests__regression_tuplesort.snap:6 tests/snapshots/tests__regression_union.snap:15 tests/snapshots/tests__regression_update.snap:29 tests/snapshots/tests__regression_window.snap:72 tests/snapshots/tests__regression_with.snap:9 -tests/snapshots/tests__regression_xml.snap:393 +tests/snapshots/tests__regression_xml.snap:379 diff --git a/crates/squawk_parser/tests/snapshots/tests__regression_transactions.snap b/crates/squawk_parser/tests/snapshots/tests__regression_transactions.snap index 5f9ccd47..8a627bce 100644 --- a/crates/squawk_parser/tests/snapshots/tests__regression_transactions.snap +++ b/crates/squawk_parser/tests/snapshots/tests__regression_transactions.snap @@ -2,117 +2,4 @@ source: crates/squawk_parser/tests/tests.rs input_file: crates/squawk_parser/tests/data/regression_suite/transactions.sql --- -ERROR@13916: expected SEMICOLON -ERROR@13916: expected command, found ERROR -ERROR@13927: expected SEMICOLON -ERROR@13927: expected command, found ERROR -ERROR@13998: expected SEMICOLON -ERROR@13998: expected command, found ERROR -ERROR@14121: expected SEMICOLON -ERROR@14121: expected command, found ERROR -ERROR@14145: expected SEMICOLON -ERROR@14145: expected command, found ERROR -ERROR@14309: expected SEMICOLON -ERROR@14309: expected command, found ERROR -ERROR@14341: expected SEMICOLON -ERROR@14341: expected command, found ERROR -ERROR@14413: expected SEMICOLON -ERROR@14413: expected command, found ERROR -ERROR@14445: expected SEMICOLON -ERROR@14445: expected command, found ERROR -ERROR@14626: expected SEMICOLON -ERROR@14626: expected command, found ERROR -ERROR@14634: expected SEMICOLON -ERROR@14634: expected command, found ERROR -ERROR@14684: expected SEMICOLON -ERROR@14684: expected command, found ERROR -ERROR@14692: expected SEMICOLON -ERROR@14692: expected command, found ERROR -ERROR@14836: expected SEMICOLON -ERROR@14836: expected command, found ERROR -ERROR@14845: expected SEMICOLON -ERROR@14845: expected command, found ERROR -ERROR@14877: expected SEMICOLON -ERROR@14877: expected command, found ERROR -ERROR@14973: expected SEMICOLON -ERROR@14973: expected command, found ERROR -ERROR@14984: expected SEMICOLON -ERROR@14984: expected command, found ERROR -ERROR@15163: expected SEMICOLON -ERROR@15163: expected command, found ERROR -ERROR@15182: expected SEMICOLON -ERROR@15182: expected command, found ERROR -ERROR@15191: expected SEMICOLON -ERROR@15191: expected command, found ERROR -ERROR@15283: expected SEMICOLON -ERROR@15283: expected command, found ERROR -ERROR@15308: expected SEMICOLON -ERROR@15308: expected command, found ERROR -ERROR@15317: expected SEMICOLON -ERROR@15317: expected command, found ERROR -ERROR@15358: expected SEMICOLON -ERROR@15358: expected command, found ERROR -ERROR@15379: expected SEMICOLON -ERROR@15379: expected command, found ERROR -ERROR@15402: expected SEMICOLON -ERROR@15402: expected command, found ERROR -ERROR@15491: expected SEMICOLON -ERROR@15491: expected command, found ERROR -ERROR@15499: expected SEMICOLON -ERROR@15499: expected command, found ERROR -ERROR@15514: expected SEMICOLON -ERROR@15514: expected command, found ERROR -ERROR@15541: expected SEMICOLON -ERROR@15541: expected command, found ERROR -ERROR@15634: expected SEMICOLON -ERROR@15634: expected command, found ERROR -ERROR@15719: expected SEMICOLON -ERROR@15719: expected command, found ERROR -ERROR@15893: expected SEMICOLON -ERROR@15893: expected command, found ERROR -ERROR@15902: expected SEMICOLON -ERROR@15902: expected command, found ERROR -ERROR@15937: expected SEMICOLON -ERROR@15937: expected command, found ERROR -ERROR@16012: expected SEMICOLON -ERROR@16012: expected command, found ERROR -ERROR@16023: expected SEMICOLON -ERROR@16023: expected command, found ERROR -ERROR@16059: expected SEMICOLON -ERROR@16059: expected command, found ERROR -ERROR@16188: expected SEMICOLON -ERROR@16188: expected command, found ERROR -ERROR@16207: expected SEMICOLON -ERROR@16207: expected command, found ERROR -ERROR@16243: expected SEMICOLON -ERROR@16243: expected command, found ERROR -ERROR@16316: expected SEMICOLON -ERROR@16316: expected command, found ERROR -ERROR@16337: expected SEMICOLON -ERROR@16337: expected command, found ERROR -ERROR@16373: expected SEMICOLON -ERROR@16373: expected command, found ERROR -ERROR@16514: expected SEMICOLON -ERROR@16514: expected command, found ERROR -ERROR@16550: expected SEMICOLON -ERROR@16550: expected command, found ERROR -ERROR@16707: expected SEMICOLON -ERROR@16707: expected command, found ERROR -ERROR@16743: expected SEMICOLON -ERROR@16743: expected command, found ERROR -ERROR@17026: expected SEMICOLON -ERROR@17026: expected command, found ERROR -ERROR@17062: expected SEMICOLON -ERROR@17062: expected command, found ERROR -ERROR@17071: expected SEMICOLON -ERROR@17071: expected command, found ERROR -ERROR@17107: expected SEMICOLON -ERROR@17107: expected command, found ERROR -ERROR@17259: expected SEMICOLON -ERROR@17259: expected command, found ERROR -ERROR@17295: expected SEMICOLON -ERROR@17295: expected command, found ERROR -ERROR@17306: expected SEMICOLON -ERROR@17306: expected command, found ERROR -ERROR@17342: expected SEMICOLON -ERROR@17342: expected command, found ERROR + diff --git a/crates/squawk_parser/tests/snapshots/tests__regression_tuplesort.snap b/crates/squawk_parser/tests/snapshots/tests__regression_tuplesort.snap index 4787fb88..3f2a804d 100644 --- a/crates/squawk_parser/tests/snapshots/tests__regression_tuplesort.snap +++ b/crates/squawk_parser/tests/snapshots/tests__regression_tuplesort.snap @@ -2,188 +2,6 @@ source: crates/squawk_parser/tests/tests.rs input_file: crates/squawk_parser/tests/data/regression_suite/tuplesort.sql --- -ERROR@8227: expected R_PAREN -ERROR@8227: expected COMMA -ERROR@8228: expected an expression, found ORDER_KW -ERROR@8233: expected R_PAREN -ERROR@8236: missing comma -ERROR@8250: missing comma -ERROR@8261: expected SEMICOLON -ERROR@8261: expected command, found R_PAREN -ERROR@8262: expected command, found R_PAREN -ERROR@8263: expected command, found L_BRACK -ERROR@8264: expected command, found INT_NUMBER -ERROR@8265: expected command, found COLON -ERROR@8266: expected command, found INT_NUMBER -ERROR@8267: expected command, found R_BRACK -ERROR@8268: expected command, found COMMA -ERROR@8318: expected command, found IDENT -ERROR@8333: expected command, found L_PAREN -ERROR@8334: expected command, found FLOAT_NUMBER -ERROR@8338: expected command, found R_PAREN -ERROR@8340: expected command, found WITHIN_KW -ERROR@8347: expected command, found GROUP_KW -ERROR@8353: expected command, found L_PAREN -ERROR@8354: expected command, found ORDER_KW -ERROR@8360: expected command, found BY_KW -ERROR@8363: expected command, found IDENT -ERROR@8365: expected command, found R_PAREN -ERROR@8366: expected command, found COMMA -ERROR@8402: expected command, found IDENT -ERROR@8417: expected command, found L_PAREN -ERROR@8418: expected command, found FLOAT_NUMBER -ERROR@8422: expected command, found R_PAREN -ERROR@8424: expected command, found WITHIN_KW -ERROR@8431: expected command, found GROUP_KW -ERROR@8437: expected command, found L_PAREN -ERROR@8438: expected command, found ORDER_KW -ERROR@8444: expected command, found BY_KW -ERROR@8447: expected command, found IDENT -ERROR@8449: expected command, found R_PAREN -ERROR@8450: expected command, found COMMA -ERROR@8498: expected command, found IDENT -ERROR@8513: expected command, found L_PAREN -ERROR@8514: expected command, found FLOAT_NUMBER -ERROR@8517: expected command, found R_PAREN -ERROR@8519: expected command, found WITHIN_KW -ERROR@8526: expected command, found GROUP_KW -ERROR@8532: expected command, found L_PAREN -ERROR@8533: expected command, found ORDER_KW -ERROR@8539: expected command, found BY_KW -ERROR@8542: expected command, found IDENT -ERROR@8558: expected command, found R_PAREN -ERROR@8559: expected command, found COMMA -ERROR@8610: expected command, found IDENT -ERROR@8625: expected command, found L_PAREN -ERROR@8626: expected command, found FLOAT_NUMBER -ERROR@8629: expected command, found R_PAREN -ERROR@8631: expected command, found WITHIN_KW -ERROR@8638: expected command, found GROUP_KW -ERROR@8644: expected command, found L_PAREN -ERROR@8645: expected command, found ORDER_KW -ERROR@8651: expected command, found BY_KW -ERROR@8654: expected command, found IDENT -ERROR@8656: expected command, found COLON -ERROR@8657: expected command, found COLON -ERROR@8658: expected command, found TEXT_KW -ERROR@8662: expected command, found R_PAREN -ERROR@8663: expected command, found COMMA -ERROR@8699: expected command, found IDENT -ERROR@8703: expected command, found L_PAREN -ERROR@8704: expected command, found STRING -ERROR@8742: expected command, found COMMA -ERROR@8744: expected command, found STRING -ERROR@8747: expected command, found COMMA -ERROR@8749: expected command, found STRING -ERROR@8752: expected command, found R_PAREN -ERROR@8754: expected command, found WITHIN_KW -ERROR@8761: expected command, found GROUP_KW -ERROR@8767: expected command, found L_PAREN -ERROR@8768: expected command, found ORDER_KW -ERROR@8774: expected command, found BY_KW -ERROR@8777: expected command, found IDENT -ERROR@8795: expected command, found COMMA -ERROR@8797: expected command, found IDENT -ERROR@8799: expected command, found COMMA -ERROR@8801: expected command, found IDENT -ERROR@8803: expected command, found COLON -ERROR@8804: expected command, found COLON -ERROR@8805: expected command, found TEXT_KW -ERROR@8809: expected command, found R_PAREN -ERROR@8811: expected command, found FROM_KW -ERROR@8909: expected SEMICOLON -ERROR@8910: expected command, found IDENT -ERROR@9150: expected R_PAREN -ERROR@9150: expected COMMA -ERROR@9151: expected an expression, found ORDER_KW -ERROR@9156: expected R_PAREN -ERROR@9159: missing comma -ERROR@9173: missing comma -ERROR@9184: expected SEMICOLON -ERROR@9184: expected command, found R_PAREN -ERROR@9185: expected command, found R_PAREN -ERROR@9186: expected command, found L_BRACK -ERROR@9187: expected command, found INT_NUMBER -ERROR@9188: expected command, found COLON -ERROR@9189: expected command, found INT_NUMBER -ERROR@9190: expected command, found R_BRACK -ERROR@9191: expected command, found COMMA -ERROR@9197: expected command, found IDENT -ERROR@9212: expected command, found L_PAREN -ERROR@9213: expected command, found FLOAT_NUMBER -ERROR@9217: expected command, found R_PAREN -ERROR@9219: expected command, found WITHIN_KW -ERROR@9226: expected command, found GROUP_KW -ERROR@9232: expected command, found L_PAREN -ERROR@9233: expected command, found ORDER_KW -ERROR@9239: expected command, found BY_KW -ERROR@9242: expected command, found IDENT -ERROR@9244: expected command, found R_PAREN -ERROR@9245: expected command, found COMMA -ERROR@9251: expected command, found IDENT -ERROR@9266: expected command, found L_PAREN -ERROR@9267: expected command, found FLOAT_NUMBER -ERROR@9271: expected command, found R_PAREN -ERROR@9273: expected command, found WITHIN_KW -ERROR@9280: expected command, found GROUP_KW -ERROR@9286: expected command, found L_PAREN -ERROR@9287: expected command, found ORDER_KW -ERROR@9293: expected command, found BY_KW -ERROR@9296: expected command, found IDENT -ERROR@9298: expected command, found R_PAREN -ERROR@9299: expected command, found COMMA -ERROR@9305: expected command, found IDENT -ERROR@9320: expected command, found L_PAREN -ERROR@9321: expected command, found FLOAT_NUMBER -ERROR@9324: expected command, found R_PAREN -ERROR@9326: expected command, found WITHIN_KW -ERROR@9333: expected command, found GROUP_KW -ERROR@9339: expected command, found L_PAREN -ERROR@9340: expected command, found ORDER_KW -ERROR@9346: expected command, found BY_KW -ERROR@9349: expected command, found IDENT -ERROR@9365: expected command, found R_PAREN -ERROR@9366: expected command, found COMMA -ERROR@9372: expected command, found IDENT -ERROR@9387: expected command, found L_PAREN -ERROR@9388: expected command, found FLOAT_NUMBER -ERROR@9391: expected command, found R_PAREN -ERROR@9393: expected command, found WITHIN_KW -ERROR@9400: expected command, found GROUP_KW -ERROR@9406: expected command, found L_PAREN -ERROR@9407: expected command, found ORDER_KW -ERROR@9413: expected command, found BY_KW -ERROR@9416: expected command, found IDENT -ERROR@9418: expected command, found COLON -ERROR@9419: expected command, found COLON -ERROR@9420: expected command, found TEXT_KW -ERROR@9424: expected command, found R_PAREN -ERROR@9425: expected command, found COMMA -ERROR@9431: expected command, found IDENT -ERROR@9435: expected command, found L_PAREN -ERROR@9436: expected command, found STRING -ERROR@9474: expected command, found COMMA -ERROR@9476: expected command, found STRING -ERROR@9479: expected command, found COMMA -ERROR@9481: expected command, found STRING -ERROR@9484: expected command, found R_PAREN -ERROR@9486: expected command, found WITHIN_KW -ERROR@9493: expected command, found GROUP_KW -ERROR@9499: expected command, found L_PAREN -ERROR@9500: expected command, found ORDER_KW -ERROR@9506: expected command, found BY_KW -ERROR@9509: expected command, found IDENT -ERROR@9527: expected command, found COMMA -ERROR@9529: expected command, found IDENT -ERROR@9531: expected command, found COMMA -ERROR@9533: expected command, found IDENT -ERROR@9535: expected command, found COLON -ERROR@9536: expected command, found COLON -ERROR@9537: expected command, found TEXT_KW -ERROR@9541: expected command, found R_PAREN -ERROR@9543: expected command, found FROM_KW -ERROR@9641: expected SEMICOLON -ERROR@9642: expected command, found IDENT ERROR@10543: expected command, found STRING ERROR@10548: expected SELECT, INSERT, UPDATE, DELETE, MERGE, VALUES, EXECUTE, DECLARE, CREATE TABLE AS, or CREATE MATERIALIZED VIEW AS ERROR@10550: expected command, found STRING diff --git a/crates/squawk_parser/tests/snapshots/tests__regression_xml.snap b/crates/squawk_parser/tests/snapshots/tests__regression_xml.snap index 99a098f2..1db11172 100644 --- a/crates/squawk_parser/tests/snapshots/tests__regression_xml.snap +++ b/crates/squawk_parser/tests/snapshots/tests__regression_xml.snap @@ -2,13 +2,6 @@ source: crates/squawk_parser/tests/tests.rs input_file: crates/squawk_parser/tests/data/regression_suite/xml.sql --- -ERROR@1539: expected R_PAREN -ERROR@1539: expected R_PAREN -ERROR@1546: expected SEMICOLON -ERROR@1546: expected command, found R_PAREN -ERROR@1547: expected command, found R_PAREN -ERROR@1549: expected command, found FROM_KW -ERROR@1554: expected command, found IDENT ERROR@4527: expected R_PAREN ERROR@4531: expected SEMICOLON ERROR@4531: expected command, found R_PAREN @@ -23,13 +16,6 @@ ERROR@7937: expected command, found DOCUMENT_KW ERROR@8035: expected EQ ERROR@8042: expected SEMICOLON ERROR@8043: expected command, found CONTENT_KW -ERROR@8743: expected R_PAREN -ERROR@8743: expected R_PAREN -ERROR@8750: expected SEMICOLON -ERROR@8750: expected command, found R_PAREN -ERROR@8751: expected command, found R_PAREN -ERROR@8753: expected command, found FROM_KW -ERROR@8758: expected command, found IDENT ERROR@9037: expected R_PAREN ERROR@9041: expected SEMICOLON ERROR@9041: expected command, found R_PAREN diff --git a/crates/squawk_parser/tests/snapshots/tests__select_casts_ok.snap b/crates/squawk_parser/tests/snapshots/tests__select_casts_ok.snap index be6f9853..21b113db 100644 --- a/crates/squawk_parser/tests/snapshots/tests__select_casts_ok.snap +++ b/crates/squawk_parser/tests/snapshots/tests__select_casts_ok.snap @@ -28,12 +28,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'1234'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - NUMERIC_KW "numeric" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + NUMERIC_KW "numeric" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -83,14 +82,16 @@ SOURCE_FILE CAST_EXPR LITERAL INT_NUMBER "44" - COLON_COLON "::" - BIT_TYPE - BIT_KW "bit" - L_PAREN "(" + COLON_COLON + COLON ":" + COLON ":" + CALL_EXPR + NAME_REF + BIT_KW "bit" ARG_LIST - ARG - LITERAL - INT_NUMBER "3" + L_PAREN "(" + LITERAL + INT_NUMBER "3" R_PAREN ")" SEMICOLON ";" WHITESPACE "\n" @@ -131,21 +132,22 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'1110'" - COLON_COLON "::" - BIT_TYPE - BIT_KW "bit" - L_PAREN "(" + COLON_COLON + COLON ":" + COLON ":" + CALL_EXPR + NAME_REF + BIT_KW "bit" ARG_LIST - ARG - LITERAL - INT_NUMBER "4" + L_PAREN "(" + LITERAL + INT_NUMBER "4" R_PAREN ")" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - INTEGER_KW "integer" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + INTEGER_KW "integer" SEMICOLON ";" WHITESPACE "\n\n" SELECT @@ -157,13 +159,12 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{1,2,3}'" - COLON_COLON "::" - ARRAY_TYPE - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - INT_KW "int" + COLON_COLON + COLON ":" + COLON ":" + INDEX_EXPR + NAME_REF + INT_KW "int" L_BRACK "[" R_BRACK "]" SEMICOLON ";" @@ -177,12 +178,11 @@ SOURCE_FILE CAST_EXPR NAME_REF IDENT "foo" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - INT_KW "int" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + INT_KW "int" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -194,13 +194,12 @@ SOURCE_FILE CAST_EXPR NAME_REF IDENT "foo" - COLON_COLON "::" - ARRAY_TYPE - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - NUMERIC_KW "numeric" + COLON_COLON + COLON ":" + COLON ":" + INDEX_EXPR + NAME_REF + NUMERIC_KW "numeric" L_BRACK "[" R_BRACK "]" SEMICOLON ";" @@ -217,36 +216,33 @@ SOURCE_FILE LITERAL STRING "'{}'" WHITESPACE " " - COLON_COLON "::" + COLON_COLON + COLON ":" + COLON ":" WHITESPACE " " - ARRAY_TYPE - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - INT_KW "int" + INDEX_EXPR + NAME_REF + INT_KW "int" L_BRACK "[" R_BRACK "]" WHITESPACE " " - COLON_COLON "::" + COLON_COLON + COLON ":" + COLON ":" WHITESPACE " " - ARRAY_TYPE - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "int8" + INDEX_EXPR + NAME_REF + IDENT "int8" L_BRACK "[" R_BRACK "]" WHITESPACE " " - COLON_COLON "::" + COLON_COLON + COLON ":" + COLON ":" WHITESPACE " " - ARRAY_TYPE - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - NUMERIC_KW "numeric" + INDEX_EXPR + NAME_REF + NUMERIC_KW "numeric" L_BRACK "[" LITERAL INT_NUMBER "1" @@ -264,31 +260,28 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{}'" - COLON_COLON "::" - ARRAY_TYPE - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - INT_KW "int" + COLON_COLON + COLON ":" + COLON ":" + INDEX_EXPR + NAME_REF + INT_KW "int" L_BRACK "[" R_BRACK "]" - COLON_COLON "::" - ARRAY_TYPE - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "int8" + COLON_COLON + COLON ":" + COLON ":" + INDEX_EXPR + NAME_REF + IDENT "int8" L_BRACK "[" R_BRACK "]" - COLON_COLON "::" - ARRAY_TYPE - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - NUMERIC_KW "numeric" + COLON_COLON + COLON ":" + COLON ":" + INDEX_EXPR + NAME_REF + NUMERIC_KW "numeric" L_BRACK "[" LITERAL INT_NUMBER "1" @@ -308,8 +301,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'1001'" - COLON_COLON "::" - BIT_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF BIT_KW "bit" WHITESPACE " " VARYING_KW "varying" @@ -324,16 +319,18 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'1001'" - COLON_COLON "::" - BIT_TYPE - BIT_KW "bit" - WHITESPACE " " - VARYING_KW "varying" - L_PAREN "(" + COLON_COLON + COLON ":" + COLON ":" + CALL_EXPR + NAME_REF + BIT_KW "bit" + WHITESPACE " " + VARYING_KW "varying" ARG_LIST - ARG - LITERAL - INT_NUMBER "4" + L_PAREN "(" + LITERAL + INT_NUMBER "4" R_PAREN ")" SEMICOLON ";" WHITESPACE "\n\n" @@ -348,8 +345,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'abc'" - COLON_COLON "::" - CHAR_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF CHARACTER_KW "character" SEMICOLON ";" WHITESPACE "\n" @@ -362,8 +361,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'abc'" - COLON_COLON "::" - CHAR_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF CHARACTER_KW "character" WHITESPACE " " VARYING_KW "varying" @@ -378,8 +379,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'abc'" - COLON_COLON "::" - CHAR_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF CHAR_KW "char" SEMICOLON ";" WHITESPACE "\n" @@ -392,8 +395,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'abc'" - COLON_COLON "::" - CHAR_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF CHAR_KW "char" WHITESPACE " " VARYING_KW "varying" @@ -408,8 +413,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'abc'" - COLON_COLON "::" - CHAR_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF VARCHAR_KW "varchar" SEMICOLON ";" WHITESPACE "\n\n" @@ -422,8 +429,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'abc'" - COLON_COLON "::" - CHAR_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF NATIONAL_KW "national" WHITESPACE " " CHARACTER_KW "character" @@ -438,8 +447,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'abc'" - COLON_COLON "::" - CHAR_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF NATIONAL_KW "national" WHITESPACE " " CHARACTER_KW "character" @@ -456,8 +467,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'abc'" - COLON_COLON "::" - CHAR_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF NATIONAL_KW "national" WHITESPACE " " CHAR_KW "char" @@ -472,8 +485,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'abc'" - COLON_COLON "::" - CHAR_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF NATIONAL_KW "national" WHITESPACE " " CHAR_KW "char" @@ -490,8 +505,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'abc'" - COLON_COLON "::" - CHAR_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF NCHAR_KW "nchar" SEMICOLON ";" WHITESPACE "\n" @@ -504,8 +521,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'abc'" - COLON_COLON "::" - CHAR_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF NCHAR_KW "nchar" WHITESPACE " " VARYING_KW "varying" @@ -520,9 +539,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'abc'" - COLON_COLON "::" - ARRAY_TYPE - CHAR_TYPE + COLON_COLON + COLON ":" + COLON ":" + INDEX_EXPR + NAME_REF NCHAR_KW "nchar" WHITESPACE " " VARYING_KW "varying" @@ -541,10 +562,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'2024-01-01 12:34:56.123456'" - COLON_COLON "::" - TIME_TYPE - NAME_REF - TIMESTAMP_KW "timestamp" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + TIMESTAMP_KW "timestamp" L_PAREN "(" LITERAL INT_NUMBER "2" @@ -560,21 +582,21 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'2024-01-01 12:34:56.123456'" - COLON_COLON "::" - TIME_TYPE - NAME_REF - TIMESTAMP_KW "timestamp" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + TIMESTAMP_KW "timestamp" L_PAREN "(" LITERAL INT_NUMBER "2" R_PAREN ")" WHITESPACE " " - WITH_TIMEZONE - WITH_KW "with" - WHITESPACE " " - TIME_KW "time" - WHITESPACE " " - ZONE_KW "zone" + WITH_KW "with" + WHITESPACE " " + TIME_KW "time" + WHITESPACE " " + ZONE_KW "zone" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -586,21 +608,21 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'2024-01-01 12:34:56.123456'" - COLON_COLON "::" - TIME_TYPE - NAME_REF - TIMESTAMP_KW "timestamp" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + TIMESTAMP_KW "timestamp" L_PAREN "(" LITERAL INT_NUMBER "2" R_PAREN ")" WHITESPACE " " - WITHOUT_TIMEZONE - WITHOUT_KW "without" - WHITESPACE " " - TIME_KW "time" - WHITESPACE " " - ZONE_KW "zone" + WITHOUT_KW "without" + WHITESPACE " " + TIME_KW "time" + WHITESPACE " " + ZONE_KW "zone" SEMICOLON ";" WHITESPACE "\n\n" SELECT @@ -612,10 +634,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'2024-01-01 12:34:56.123456'" - COLON_COLON "::" - TIME_TYPE - NAME_REF - TIMESTAMP_KW "timestamp" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + TIMESTAMP_KW "timestamp" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -627,17 +650,17 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'2024-01-01 12:34:56.123456'" - COLON_COLON "::" - TIME_TYPE - NAME_REF - TIMESTAMP_KW "timestamp" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + TIMESTAMP_KW "timestamp" WHITESPACE " " - WITH_TIMEZONE - WITH_KW "with" - WHITESPACE " " - TIME_KW "time" - WHITESPACE " " - ZONE_KW "zone" + WITH_KW "with" + WHITESPACE " " + TIME_KW "time" + WHITESPACE " " + ZONE_KW "zone" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -649,17 +672,17 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'2024-01-01 12:34:56.123456'" - COLON_COLON "::" - TIME_TYPE - NAME_REF - TIMESTAMP_KW "timestamp" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + TIMESTAMP_KW "timestamp" WHITESPACE " " - WITHOUT_TIMEZONE - WITHOUT_KW "without" - WHITESPACE " " - TIME_KW "time" - WHITESPACE " " - ZONE_KW "zone" + WITHOUT_KW "without" + WHITESPACE " " + TIME_KW "time" + WHITESPACE " " + ZONE_KW "zone" SEMICOLON ";" WHITESPACE "\n\n" SELECT @@ -671,10 +694,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'2024-01-01 12:34:56.123456'" - COLON_COLON "::" - TIME_TYPE - NAME_REF - TIME_KW "time" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + TIME_KW "time" L_PAREN "(" LITERAL INT_NUMBER "2" @@ -690,21 +714,21 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'2024-01-01 12:34:56.123456'" - COLON_COLON "::" - TIME_TYPE - NAME_REF - TIME_KW "time" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + TIME_KW "time" L_PAREN "(" LITERAL INT_NUMBER "2" R_PAREN ")" WHITESPACE " " - WITH_TIMEZONE - WITH_KW "with" - WHITESPACE " " - TIME_KW "time" - WHITESPACE " " - ZONE_KW "zone" + WITH_KW "with" + WHITESPACE " " + TIME_KW "time" + WHITESPACE " " + ZONE_KW "zone" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -716,21 +740,21 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'2024-01-01 12:34:56.123456'" - COLON_COLON "::" - TIME_TYPE - NAME_REF - TIME_KW "time" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + TIME_KW "time" L_PAREN "(" LITERAL INT_NUMBER "2" R_PAREN ")" WHITESPACE " " - WITHOUT_TIMEZONE - WITHOUT_KW "without" - WHITESPACE " " - TIME_KW "time" - WHITESPACE " " - ZONE_KW "zone" + WITHOUT_KW "without" + WHITESPACE " " + TIME_KW "time" + WHITESPACE " " + ZONE_KW "zone" SEMICOLON ";" WHITESPACE "\n\n" SELECT @@ -742,10 +766,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'2024-01-01 12:34:56.123456'" - COLON_COLON "::" - TIME_TYPE - NAME_REF - TIME_KW "time" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + TIME_KW "time" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -757,17 +782,17 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'2024-01-01 12:34:56.123456'" - COLON_COLON "::" - TIME_TYPE - NAME_REF - TIME_KW "time" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + TIME_KW "time" WHITESPACE " " - WITH_TIMEZONE - WITH_KW "with" - WHITESPACE " " - TIME_KW "time" - WHITESPACE " " - ZONE_KW "zone" + WITH_KW "with" + WHITESPACE " " + TIME_KW "time" + WHITESPACE " " + ZONE_KW "zone" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -779,17 +804,17 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'2024-01-01 12:34:56.123456'" - COLON_COLON "::" - TIME_TYPE - NAME_REF - TIME_KW "time" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + TIME_KW "time" WHITESPACE " " - WITHOUT_TIMEZONE - WITHOUT_KW "without" - WHITESPACE " " - TIME_KW "time" - WHITESPACE " " - ZONE_KW "zone" + WITHOUT_KW "without" + WHITESPACE " " + TIME_KW "time" + WHITESPACE " " + ZONE_KW "zone" SEMICOLON ";" WHITESPACE "\n\n" COMMENT "-- timestamp with time zone cast" @@ -990,8 +1015,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'10 days'" - COLON_COLON "::" - INTERVAL_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF INTERVAL_KW "interval" SEMICOLON ";" WHITESPACE "\n\n" @@ -1004,8 +1031,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'10 days'" - COLON_COLON "::" - INTERVAL_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF INTERVAL_KW "interval" WHITESPACE " " YEAR_KW "year" @@ -1020,8 +1049,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'10 days'" - COLON_COLON "::" - INTERVAL_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF INTERVAL_KW "interval" WHITESPACE " " MONTH_KW "month" @@ -1036,8 +1067,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'10 days'" - COLON_COLON "::" - INTERVAL_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF INTERVAL_KW "interval" L_PAREN "(" LITERAL @@ -1054,8 +1087,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'10 days'" - COLON_COLON "::" - INTERVAL_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF INTERVAL_KW "interval" WHITESPACE " " DAY_KW "day" @@ -1070,8 +1105,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'10 days'" - COLON_COLON "::" - INTERVAL_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF INTERVAL_KW "interval" WHITESPACE " " HOUR_KW "hour" @@ -1086,8 +1123,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'10 days'" - COLON_COLON "::" - INTERVAL_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF INTERVAL_KW "interval" WHITESPACE " " MINUTE_KW "minute" @@ -1102,8 +1141,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'10 days'" - COLON_COLON "::" - INTERVAL_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF INTERVAL_KW "interval" WHITESPACE " " SECOND_KW "second" @@ -1118,8 +1159,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'10 days'" - COLON_COLON "::" - INTERVAL_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF INTERVAL_KW "interval" WHITESPACE " " SECOND_KW "second" @@ -1138,8 +1181,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'10 days'" - COLON_COLON "::" - INTERVAL_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF INTERVAL_KW "interval" WHITESPACE " " YEAR_KW "year" @@ -1158,8 +1203,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'10 days'" - COLON_COLON "::" - INTERVAL_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF INTERVAL_KW "interval" WHITESPACE " " DAY_KW "day" @@ -1178,8 +1225,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'10 days'" - COLON_COLON "::" - INTERVAL_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF INTERVAL_KW "interval" WHITESPACE " " DAY_KW "day" @@ -1198,8 +1247,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'10 days'" - COLON_COLON "::" - INTERVAL_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF INTERVAL_KW "interval" WHITESPACE " " DAY_KW "day" @@ -1218,8 +1269,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'10 days'" - COLON_COLON "::" - INTERVAL_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF INTERVAL_KW "interval" WHITESPACE " " DAY_KW "day" @@ -1242,8 +1295,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'10 days'" - COLON_COLON "::" - INTERVAL_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF INTERVAL_KW "interval" WHITESPACE " " HOUR_KW "hour" @@ -1262,8 +1317,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'10 days'" - COLON_COLON "::" - INTERVAL_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF INTERVAL_KW "interval" WHITESPACE " " HOUR_KW "hour" @@ -1282,8 +1339,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'10 days'" - COLON_COLON "::" - INTERVAL_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF INTERVAL_KW "interval" WHITESPACE " " HOUR_KW "hour" @@ -1306,8 +1365,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'10 days'" - COLON_COLON "::" - INTERVAL_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF INTERVAL_KW "interval" WHITESPACE " " MINUTE_KW "minute" @@ -1326,8 +1387,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'10 days'" - COLON_COLON "::" - INTERVAL_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF INTERVAL_KW "interval" WHITESPACE " " MINUTE_KW "minute" @@ -1350,8 +1413,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'10 days'" - COLON_COLON "::" - INTERVAL_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF INTERVAL_KW "interval" L_PAREN "(" LITERAL @@ -1370,12 +1435,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{}'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - JSON_KW "json" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + JSON_KW "json" SEMICOLON ";" WHITESPACE "\n\n" COMMENT "-- jsonb type cast" @@ -1390,12 +1454,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'\"foo\"'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" WHITESPACE " " CUSTOM_OP AT "@" @@ -1404,12 +1467,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'\"foo\"'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" SEMICOLON ";" WHITESPACE "\n\n" COMMENT "-- GenericType" @@ -1423,17 +1485,15 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - PATH_TYPE - PATH - PATH - PATH_SEGMENT - NAME_REF - IDENT "foo" - DOT "." - PATH_SEGMENT - NAME_REF - IDENT "bar" + COLON_COLON + COLON ":" + COLON ":" + FIELD_EXPR + NAME_REF + IDENT "foo" + DOT "." + NAME_REF + IDENT "bar" SEMICOLON ";" WHITESPACE "\n\n" SELECT @@ -1445,27 +1505,24 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - PATH_TYPE - PATH - PATH - PATH_SEGMENT - NAME_REF - IDENT "foo" + COLON_COLON + COLON ":" + COLON ":" + CALL_EXPR + FIELD_EXPR + NAME_REF + IDENT "foo" DOT "." - PATH_SEGMENT - NAME_REF - IDENT "bar" - L_PAREN "(" + NAME_REF + IDENT "bar" ARG_LIST - ARG - NAME_REF - IDENT "buzz" + L_PAREN "(" + NAME_REF + IDENT "buzz" COMMA "," WHITESPACE " " - ARG - NAME_REF - IDENT "bizz" + NAME_REF + IDENT "bizz" R_PAREN ")" SEMICOLON ";" WHITESPACE "\n\n" @@ -1478,8 +1535,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'abc'" - COLON_COLON "::" - CHAR_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF VARCHAR_KW "varchar" SEMICOLON ";" WHITESPACE "\n" @@ -1492,14 +1551,16 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'abc'" - COLON_COLON "::" - CHAR_TYPE - VARCHAR_KW "varchar" - L_PAREN "(" + COLON_COLON + COLON ":" + COLON ":" + CALL_EXPR + NAME_REF + VARCHAR_KW "varchar" ARG_LIST - ARG - LITERAL - INT_NUMBER "5" + L_PAREN "(" + LITERAL + INT_NUMBER "5" R_PAREN ")" SEMICOLON ";" WHITESPACE "\n" @@ -1512,15 +1573,17 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - ARRAY_TYPE - CHAR_TYPE - VARCHAR_KW "varchar" - L_PAREN "(" + COLON_COLON + COLON ":" + COLON ":" + INDEX_EXPR + CALL_EXPR + NAME_REF + VARCHAR_KW "varchar" ARG_LIST - ARG - LITERAL - INT_NUMBER "255" + L_PAREN "(" + LITERAL + INT_NUMBER "255" R_PAREN ")" L_BRACK "[" R_BRACK "]" @@ -1535,9 +1598,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - ARRAY_TYPE - CHAR_TYPE + COLON_COLON + COLON ":" + COLON ":" + INDEX_EXPR + NAME_REF VARCHAR_KW "varchar" L_BRACK "[" LITERAL @@ -1554,18 +1619,17 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - ARRAY_TYPE - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "t" - L_PAREN "(" + COLON_COLON + COLON ":" + COLON ":" + INDEX_EXPR + CALL_EXPR + NAME_REF + IDENT "t" ARG_LIST - ARG - LITERAL - INT_NUMBER "255" + L_PAREN "(" + LITERAL + INT_NUMBER "255" R_PAREN ")" L_BRACK "[" R_BRACK "]" @@ -1580,22 +1644,20 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - PATH_TYPE - PATH - PATH - PATH_SEGMENT - NAME_REF - IDENT "foo" + COLON_COLON + COLON ":" + COLON ":" + CALL_EXPR + FIELD_EXPR + NAME_REF + IDENT "foo" DOT "." - PATH_SEGMENT - NAME_REF - IDENT "buzz" - L_PAREN "(" + NAME_REF + IDENT "buzz" ARG_LIST - ARG - LITERAL - INT_NUMBER "5" + L_PAREN "(" + LITERAL + INT_NUMBER "5" R_PAREN ")" SEMICOLON ";" WHITESPACE "\n" @@ -1608,23 +1670,20 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - ARRAY_TYPE - PATH_TYPE - PATH - PATH - PATH - PATH_SEGMENT - NAME_REF - IDENT "bar" - DOT "." - PATH_SEGMENT - NAME_REF - IDENT "foo" + COLON_COLON + COLON ":" + COLON ":" + INDEX_EXPR + FIELD_EXPR + FIELD_EXPR + NAME_REF + IDENT "bar" DOT "." - PATH_SEGMENT - NAME_REF - IDENT "buzz" + NAME_REF + IDENT "foo" + DOT "." + NAME_REF + IDENT "buzz" L_BRACK "[" LITERAL INT_NUMBER "5" @@ -1640,28 +1699,25 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - ARRAY_TYPE - PATH_TYPE - PATH - PATH - PATH - PATH_SEGMENT - NAME_REF - IDENT "bar" + COLON_COLON + COLON ":" + COLON ":" + INDEX_EXPR + CALL_EXPR + FIELD_EXPR + FIELD_EXPR + NAME_REF + IDENT "bar" DOT "." - PATH_SEGMENT - NAME_REF - IDENT "foo" - DOT "." - PATH_SEGMENT NAME_REF - IDENT "buzz" - L_PAREN "(" + IDENT "foo" + DOT "." + NAME_REF + IDENT "buzz" ARG_LIST - ARG - LITERAL - INT_NUMBER "255" + L_PAREN "(" + LITERAL + INT_NUMBER "255" R_PAREN ")" L_BRACK "[" R_BRACK "]" @@ -1678,12 +1734,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - INT_KW "int" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + INT_KW "int" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -1695,12 +1750,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - INTEGER_KW "integer" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + INTEGER_KW "integer" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -1712,12 +1766,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - SMALLINT_KW "smallint" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + SMALLINT_KW "smallint" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -1729,12 +1782,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - BIGINT_KW "bigint" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + BIGINT_KW "bigint" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -1746,12 +1798,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - FLOAT_KW "float" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + FLOAT_KW "float" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -1763,17 +1814,16 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - FLOAT_KW "float" - L_PAREN "(" + COLON_COLON + COLON ":" + COLON ":" + CALL_EXPR + NAME_REF + FLOAT_KW "float" ARG_LIST - ARG - LITERAL - INT_NUMBER "1" + L_PAREN "(" + LITERAL + INT_NUMBER "1" R_PAREN ")" SEMICOLON ";" WHITESPACE "\n" @@ -1786,8 +1836,10 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - DOUBLE_TYPE + COLON_COLON + COLON ":" + COLON ":" + NAME_REF DOUBLE_KW "double" WHITESPACE " " PRECISION_KW "precision" @@ -1802,12 +1854,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - DECIMAL_KW "decimal" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + DECIMAL_KW "decimal" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -1819,27 +1870,24 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - DECIMAL_KW "decimal" - L_PAREN "(" + COLON_COLON + COLON ":" + COLON ":" + CALL_EXPR + NAME_REF + DECIMAL_KW "decimal" ARG_LIST - ARG - LITERAL - INT_NUMBER "1" + L_PAREN "(" + LITERAL + INT_NUMBER "1" COMMA "," WHITESPACE " " - ARG - LITERAL - INT_NUMBER "2" + LITERAL + INT_NUMBER "2" COMMA "," WHITESPACE " " - ARG - LITERAL - INT_NUMBER "3" + LITERAL + INT_NUMBER "3" R_PAREN ")" SEMICOLON ";" WHITESPACE "\n" @@ -1852,12 +1900,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - DEC_KW "dec" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + DEC_KW "dec" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -1869,27 +1916,24 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - DEC_KW "dec" - L_PAREN "(" + COLON_COLON + COLON ":" + COLON ":" + CALL_EXPR + NAME_REF + DEC_KW "dec" ARG_LIST - ARG - LITERAL - INT_NUMBER "1" + L_PAREN "(" + LITERAL + INT_NUMBER "1" COMMA "," WHITESPACE " " - ARG - LITERAL - INT_NUMBER "2" + LITERAL + INT_NUMBER "2" COMMA "," WHITESPACE " " - ARG - LITERAL - INT_NUMBER "3" + LITERAL + INT_NUMBER "3" R_PAREN ")" SEMICOLON ";" WHITESPACE "\n" @@ -1902,12 +1946,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - NUMERIC_KW "numeric" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + NUMERIC_KW "numeric" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -1919,22 +1962,20 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - NUMERIC_KW "numeric" - L_PAREN "(" + COLON_COLON + COLON ":" + COLON ":" + CALL_EXPR + NAME_REF + NUMERIC_KW "numeric" ARG_LIST - ARG - LITERAL - INT_NUMBER "1" + L_PAREN "(" + LITERAL + INT_NUMBER "1" COMMA "," WHITESPACE " " - ARG - LITERAL - INT_NUMBER "2" + LITERAL + INT_NUMBER "2" R_PAREN ")" SEMICOLON ";" WHITESPACE "\n" @@ -1947,12 +1988,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - BOOLEAN_KW "boolean" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + BOOLEAN_KW "boolean" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -1964,22 +2004,20 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - ARRAY_TYPE - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - NUMERIC_KW "numeric" - L_PAREN "(" + COLON_COLON + COLON ":" + COLON ":" + INDEX_EXPR + CALL_EXPR + NAME_REF + NUMERIC_KW "numeric" ARG_LIST - ARG - LITERAL - INT_NUMBER "10" + L_PAREN "(" + LITERAL + INT_NUMBER "10" COMMA "," - ARG - LITERAL - INT_NUMBER "2" + LITERAL + INT_NUMBER "2" R_PAREN ")" L_BRACK "[" LITERAL @@ -2309,14 +2347,16 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "''" - COLON_COLON "::" - CHAR_TYPE - CHAR_KW "char" - L_PAREN "(" + COLON_COLON + COLON ":" + COLON ":" + CALL_EXPR + NAME_REF + CHAR_KW "char" ARG_LIST - ARG - LITERAL - INT_NUMBER "1" + L_PAREN "(" + LITERAL + INT_NUMBER "1" R_PAREN ")" WHITESPACE " " COLLATE_KW "collate" @@ -2336,14 +2376,16 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'a '" - COLON_COLON "::" - CHAR_TYPE - CHAR_KW "CHAR" - L_PAREN "(" + COLON_COLON + COLON ":" + COLON ":" + CALL_EXPR + NAME_REF + CHAR_KW "CHAR" ARG_LIST - ARG - LITERAL - INT_NUMBER "2" + L_PAREN "(" + LITERAL + INT_NUMBER "2" R_PAREN ")" WHITESPACE " " COLLATE_KW "collate" @@ -2356,14 +2398,16 @@ SOURCE_FILE CAST_EXPR LITERAL ESC_STRING "E'a\\n'" - COLON_COLON "::" - CHAR_TYPE - CHAR_KW "CHAR" - L_PAREN "(" + COLON_COLON + COLON ":" + COLON ":" + CALL_EXPR + NAME_REF + CHAR_KW "CHAR" ARG_LIST - ARG - LITERAL - INT_NUMBER "2" + L_PAREN "(" + LITERAL + INT_NUMBER "2" R_PAREN ")" SEMICOLON ";" WHITESPACE "\n\n" @@ -2524,29 +2568,33 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{1}'" - COLON_COLON "::" - ARRAY_TYPE - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - INTEGER_KW "integer" - L_BRACK "[" - LITERAL - INT_NUMBER "1" - R_BRACK "]" - L_BRACK "[" - LITERAL - INT_NUMBER "2" - R_BRACK "]" - L_BRACK "[" - LITERAL - INT_NUMBER "3" - R_BRACK "]" - L_BRACK "[" - R_BRACK "]" - L_BRACK "[" - R_BRACK "]" + COLON_COLON + COLON ":" + COLON ":" + INDEX_EXPR + INDEX_EXPR + INDEX_EXPR + INDEX_EXPR + INDEX_EXPR + INDEX_EXPR + NAME_REF + INTEGER_KW "integer" + L_BRACK "[" + LITERAL + INT_NUMBER "1" + R_BRACK "]" + L_BRACK "[" + LITERAL + INT_NUMBER "2" + R_BRACK "]" + L_BRACK "[" + LITERAL + INT_NUMBER "3" + R_BRACK "]" + L_BRACK "[" + R_BRACK "]" + L_BRACK "[" + R_BRACK "]" L_BRACK "[" LITERAL INT_NUMBER "1000" @@ -2564,13 +2612,12 @@ SOURCE_FILE ARRAY_KW "array" L_BRACK "[" R_BRACK "]" - COLON_COLON "::" - ARRAY_TYPE - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - INTEGER_KW "integer" + COLON_COLON + COLON ":" + COLON ":" + INDEX_EXPR + NAME_REF + INTEGER_KW "integer" L_BRACK "[" R_BRACK "]" SEMICOLON ";" @@ -2586,14 +2633,16 @@ SOURCE_FILE CAST_EXPR LITERAL INT_NUMBER "44" - COLON_COLON "::" - BIT_TYPE - BIT_KW "bit" - L_PAREN "(" + COLON_COLON + COLON ":" + COLON ":" + CALL_EXPR + NAME_REF + BIT_KW "bit" ARG_LIST - ARG - LITERAL - INT_NUMBER "10" + L_PAREN "(" + LITERAL + INT_NUMBER "10" R_PAREN ")" SEMICOLON ";" WHITESPACE " " @@ -2608,14 +2657,16 @@ SOURCE_FILE CAST_EXPR LITERAL INT_NUMBER "44" - COLON_COLON "::" - BIT_TYPE - BIT_KW "bit" - L_PAREN "(" + COLON_COLON + COLON ":" + COLON ":" + CALL_EXPR + NAME_REF + BIT_KW "bit" ARG_LIST - ARG - LITERAL - INT_NUMBER "3" + L_PAREN "(" + LITERAL + INT_NUMBER "3" R_PAREN ")" SEMICOLON ";" WHITESPACE " " @@ -2660,21 +2711,22 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'1110'" - COLON_COLON "::" - BIT_TYPE - BIT_KW "bit" - L_PAREN "(" + COLON_COLON + COLON ":" + COLON ":" + CALL_EXPR + NAME_REF + BIT_KW "bit" ARG_LIST - ARG - LITERAL - INT_NUMBER "4" + L_PAREN "(" + LITERAL + INT_NUMBER "4" R_PAREN ")" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - INTEGER_KW "integer" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + INTEGER_KW "integer" SEMICOLON ";" WHITESPACE " " COMMENT "-- 14" @@ -2688,17 +2740,15 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'1'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH - PATH_SEGMENT - NAME_REF - IDENT "pg_catalog" - DOT "." - PATH_SEGMENT - NAME_REF - IDENT "int8" + COLON_COLON + COLON ":" + COLON ":" + FIELD_EXPR + NAME_REF + IDENT "pg_catalog" + DOT "." + NAME_REF + IDENT "int8" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -2710,18 +2760,16 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{1}'" - COLON_COLON "::" - ARRAY_TYPE - PATH_TYPE - PATH - PATH - PATH_SEGMENT - NAME_REF - IDENT "pg_catalog" - DOT "." - PATH_SEGMENT - NAME_REF - IDENT "int8" + COLON_COLON + COLON ":" + COLON ":" + INDEX_EXPR + FIELD_EXPR + NAME_REF + IDENT "pg_catalog" + DOT "." + NAME_REF + IDENT "int8" L_BRACK "[" R_BRACK "]" SEMICOLON ";" diff --git a/crates/squawk_parser/tests/snapshots/tests__select_compound_union_select_ok.snap b/crates/squawk_parser/tests/snapshots/tests__select_compound_union_select_ok.snap index 53a18fd0..6f793a89 100644 --- a/crates/squawk_parser/tests/snapshots/tests__select_compound_union_select_ok.snap +++ b/crates/squawk_parser/tests/snapshots/tests__select_compound_union_select_ok.snap @@ -46,14 +46,16 @@ SOURCE_FILE CAST_EXPR NAME_REF LANGUAGE_KW "language" - COLON_COLON "::" - CHAR_TYPE - CHAR_KW "char" - L_PAREN "(" + COLON_COLON + COLON ":" + COLON ":" + CALL_EXPR + NAME_REF + CHAR_KW "char" ARG_LIST - ARG - LITERAL - INT_NUMBER "4" + L_PAREN "(" + LITERAL + INT_NUMBER "4" R_PAREN ")" WHITESPACE " " ORDER_BY_CLAUSE @@ -176,14 +178,16 @@ SOURCE_FILE CAST_EXPR NAME_REF LANGUAGE_KW "language" - COLON_COLON "::" - CHAR_TYPE - CHAR_KW "char" - L_PAREN "(" + COLON_COLON + COLON ":" + COLON ":" + CALL_EXPR + NAME_REF + CHAR_KW "char" ARG_LIST - ARG - LITERAL - INT_NUMBER "4" + L_PAREN "(" + LITERAL + INT_NUMBER "4" R_PAREN ")" WHITESPACE " " ORDER_BY_CLAUSE diff --git a/crates/squawk_parser/tests/snapshots/tests__select_funcs_ok.snap b/crates/squawk_parser/tests/snapshots/tests__select_funcs_ok.snap index 4040b208..0d3c8652 100644 --- a/crates/squawk_parser/tests/snapshots/tests__select_funcs_ok.snap +++ b/crates/squawk_parser/tests/snapshots/tests__select_funcs_ok.snap @@ -3641,13 +3641,12 @@ SOURCE_FILE ARRAY_KW "array" L_BRACK "[" R_BRACK "]" - COLON_COLON "::" - ARRAY_TYPE - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - NUMERIC_KW "numeric" + COLON_COLON + COLON ":" + COLON ":" + INDEX_EXPR + NAME_REF + NUMERIC_KW "numeric" L_BRACK "[" R_BRACK "]" R_PAREN ")" diff --git a/crates/squawk_parser/tests/snapshots/tests__select_funcs_pg17_ok.snap b/crates/squawk_parser/tests/snapshots/tests__select_funcs_pg17_ok.snap index a090f704..2c4b2532 100644 --- a/crates/squawk_parser/tests/snapshots/tests__select_funcs_pg17_ok.snap +++ b/crates/squawk_parser/tests/snapshots/tests__select_funcs_pg17_ok.snap @@ -401,12 +401,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{\"favorites\":\n {\"movies\":\n [{\"name\": \"One\", \"director\": \"John Doe\"},\n {\"name\": \"Two\", \"director\": \"Don Joe\"}],\n \"books\":\n [{\"name\": \"Mystery\", \"authors\": [{\"name\": \"Brown Dan\"}]},\n {\"name\": \"Wonder\", \"authors\": [{\"name\": \"Jun Murakami\"}, {\"name\":\"Craig Doe\"}]}]\n}}'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - JSON_KW "json" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + JSON_KW "json" COMMA "," WHITESPACE " " LITERAL diff --git a/crates/squawk_parser/tests/snapshots/tests__select_operators_ok.snap b/crates/squawk_parser/tests/snapshots/tests__select_operators_ok.snap index 72f9c050..718ab1a7 100644 --- a/crates/squawk_parser/tests/snapshots/tests__select_operators_ok.snap +++ b/crates/squawk_parser/tests/snapshots/tests__select_operators_ok.snap @@ -1141,12 +1141,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'cat'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "tsquery" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "tsquery" SEMICOLON ";" WHITESPACE "\n\n" COMMENT "-- subnet contain or equal subnet" @@ -2906,12 +2905,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'[{\"a\":\"foo\"},{\"b\":\"bar\"},{\"c\":\"baz\"}]'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - JSON_KW "json" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + JSON_KW "json" WHITESPACE " " CUSTOM_OP MINUS "-" @@ -2931,12 +2929,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{\"a\": {\"b\":\"foo\"}}'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - JSON_KW "json" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + JSON_KW "json" WHITESPACE " " CUSTOM_OP MINUS "-" @@ -2958,12 +2955,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'[1,2,3]'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - JSON_KW "json" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + JSON_KW "json" WHITESPACE " " CUSTOM_OP MINUS "-" @@ -2984,12 +2980,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{\"a\":1,\"b\":2}'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - JSON_KW "json" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + JSON_KW "json" WHITESPACE " " CUSTOM_OP MINUS "-" @@ -3012,12 +3007,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{\"a\": {\"b\": [\"foo\",\"bar\"]}}'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - JSON_KW "json" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + JSON_KW "json" WHITESPACE " " CUSTOM_OP POUND "#" @@ -3039,12 +3033,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{\"a\": {\"b\": [\"foo\",\"bar\"]}}'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - JSON_KW "json" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + JSON_KW "json" WHITESPACE " " CUSTOM_OP POUND "#" @@ -3067,12 +3060,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'\"foo\"'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" WHITESPACE " " CUSTOM_OP AT "@" @@ -3081,12 +3073,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'\"foo\"'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" SEMICOLON ";" WHITESPACE "\n\n" SELECT @@ -3099,12 +3090,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{\"b\":2}'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" WHITESPACE " " CUSTOM_OP L_ANGLE "<" @@ -3113,12 +3103,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{\"a\":1, \"b\":2}'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" SEMICOLON ";" WHITESPACE "\n\n" COMMENT "-- existence" @@ -3133,12 +3122,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{\"a\":1, \"b\":2}'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" WHITESPACE " " CUSTOM_OP QUESTION "?" @@ -3157,12 +3145,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'[\"a\", \"b\", \"c\"]'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" WHITESPACE " " CUSTOM_OP QUESTION "?" @@ -3183,12 +3170,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{\"a\":1, \"b\":2, \"c\":3}'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" WHITESPACE " " CUSTOM_OP QUESTION "?" @@ -3218,12 +3204,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'[\"a\", \"b\", \"c\"]'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" WHITESPACE " " CUSTOM_OP QUESTION "?" @@ -3253,12 +3238,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'[\"a\", \"b\"]'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" WHITESPACE " " CUSTOM_OP PIPE "|" @@ -3267,12 +3251,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'[\"a\", \"d\"]'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -3285,12 +3268,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{\"a\": \"b\"}'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" WHITESPACE " " CUSTOM_OP PIPE "|" @@ -3299,12 +3281,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{\"c\": \"d\"}'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -3317,12 +3298,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'[1, 2]'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" WHITESPACE " " CUSTOM_OP PIPE "|" @@ -3331,12 +3311,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'3'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -3349,12 +3328,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{\"a\": \"b\"}'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" WHITESPACE " " CUSTOM_OP PIPE "|" @@ -3363,12 +3341,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'42'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" SEMICOLON ";" WHITESPACE "\n" SELECT @@ -3381,12 +3358,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'[1, 2]'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" WHITESPACE " " CUSTOM_OP PIPE "|" @@ -3400,12 +3376,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'[3, 4]'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" R_PAREN ")" SEMICOLON ";" WHITESPACE "\n\n" @@ -3421,12 +3396,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{\"a\": \"b\", \"c\": \"d\"}'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" WHITESPACE " " MINUS "-" WHITESPACE " " @@ -3444,12 +3418,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'[\"a\", \"b\", \"c\", \"b\"]'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" WHITESPACE " " MINUS "-" WHITESPACE " " @@ -3467,25 +3440,23 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{\"a\": \"b\", \"c\": \"d\"}'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" WHITESPACE " " MINUS "-" WHITESPACE " " CAST_EXPR LITERAL STRING "'{a,c}'" - COLON_COLON "::" - ARRAY_TYPE - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - TEXT_KW "text" + COLON_COLON + COLON ":" + COLON ":" + INDEX_EXPR + NAME_REF + TEXT_KW "text" L_BRACK "[" R_BRACK "]" SEMICOLON ";" @@ -3500,12 +3471,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'[\"a\", \"b\"]'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" WHITESPACE " " MINUS "-" WHITESPACE " " @@ -3525,12 +3495,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'[\"a\", {\"b\":1}]'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" WHITESPACE " " CUSTOM_OP POUND "#" @@ -3552,12 +3521,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{\"items\": [1, 2, 3]}'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" WHITESPACE " " CUSTOM_OP AT "@" @@ -3579,12 +3547,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{\"a\":[1,2,3,4,5]}'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" WHITESPACE " " CUSTOM_OP AT "@" @@ -3638,12 +3605,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'[1, \"2\", null]'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" R_PAREN ")" L_BRACK "[" LITERAL @@ -3663,12 +3629,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{\"a\": 1}'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" R_PAREN ")" L_BRACK "[" LITERAL @@ -3690,12 +3655,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'{\"a\": {\"b\": {\"c\": 1}}}'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "jsonb" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "jsonb" R_PAREN ")" L_BRACK "[" LITERAL @@ -4085,12 +4049,11 @@ SOURCE_FILE DOT "." NAME_REF IDENT "b" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "c" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "c" WHITESPACE " " COLLATE_KW "collate" WHITESPACE " " @@ -4339,12 +4302,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'[2011-01-01,2011-03-01)'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "tsrange" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "tsrange" WHITESPACE " " CUSTOM_OP AT "@" @@ -4353,10 +4315,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'2011-01-10'" - COLON_COLON "::" - TIME_TYPE - NAME_REF - TIMESTAMP_KW "timestamp" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + TIMESTAMP_KW "timestamp" SEMICOLON ";" WHITESPACE "\n\n" COMMENT "-- first contained by second" diff --git a/crates/squawk_parser/tests/snapshots/tests__update_ok.snap b/crates/squawk_parser/tests/snapshots/tests__update_ok.snap index aeea4155..6afe6ddf 100644 --- a/crates/squawk_parser/tests/snapshots/tests__update_ok.snap +++ b/crates/squawk_parser/tests/snapshots/tests__update_ok.snap @@ -343,25 +343,28 @@ SOURCE_FILE NAME_REF IDENT "t" WHITESPACE "\n" - RETURNING_KW "returning" - WHITESPACE " " - STAR "*" - COMMA "," - WHITESPACE " " - BIN_EXPR - NAME_REF - IDENT "foo" - WHITESPACE " " - STAR "*" - WHITESPACE " " - LITERAL - INT_NUMBER "2" - WHITESPACE " " - ALIAS - AS_KW "as" + RETURNING_CLAUSE + RETURNING_KW "returning" WHITESPACE " " - NAME - IDENT "bar" + TARGET_LIST + TARGET + STAR "*" + COMMA "," + WHITESPACE " " + TARGET + BIN_EXPR + NAME_REF + IDENT "foo" + WHITESPACE " " + STAR "*" + WHITESPACE " " + LITERAL + INT_NUMBER "2" + WHITESPACE " " + AS_KW "as" + WHITESPACE " " + NAME + IDENT "bar" SEMICOLON ";" WHITESPACE "\n\n" COMMENT "-- pg_docs" @@ -535,18 +538,23 @@ SOURCE_FILE LITERAL STRING "'2003-07-03'" WHITESPACE "\n " - RETURNING_KW "RETURNING" - WHITESPACE " " - NAME_REF - IDENT "temp_lo" - COMMA "," - WHITESPACE " " - NAME_REF - IDENT "temp_hi" - COMMA "," - WHITESPACE " " - NAME_REF - IDENT "prcp" + RETURNING_CLAUSE + RETURNING_KW "RETURNING" + WHITESPACE " " + TARGET_LIST + TARGET + NAME_REF + IDENT "temp_lo" + COMMA "," + WHITESPACE " " + TARGET + NAME_REF + IDENT "temp_hi" + COMMA "," + WHITESPACE " " + TARGET + NAME_REF + IDENT "prcp" SEMICOLON ";" WHITESPACE "\n\n" UPDATE diff --git a/crates/squawk_parser/tests/snapshots/tests__values_ok.snap b/crates/squawk_parser/tests/snapshots/tests__values_ok.snap index eaa16aba..d65302cb 100644 --- a/crates/squawk_parser/tests/snapshots/tests__values_ok.snap +++ b/crates/squawk_parser/tests/snapshots/tests__values_ok.snap @@ -445,12 +445,11 @@ SOURCE_FILE CAST_EXPR LITERAL STRING "'192.168.0.1'" - COLON_COLON "::" - PATH_TYPE - PATH - PATH_SEGMENT - NAME_REF - IDENT "inet" + COLON_COLON + COLON ":" + COLON ":" + NAME_REF + IDENT "inet" R_PAREN ")" COMMA "," WHITESPACE " " diff --git a/crates/squawk_syntax/src/ast/generated/nodes.rs b/crates/squawk_syntax/src/ast/generated/nodes.rs index 9efe479c..5c460655 100644 --- a/crates/squawk_syntax/src/ast/generated/nodes.rs +++ b/crates/squawk_syntax/src/ast/generated/nodes.rs @@ -4939,6 +4939,117 @@ impl IsDistinctFrom { } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct IsJson { + pub(crate) syntax: SyntaxNode, +} +impl IsJson { + #[inline] + pub fn json_keys_unique_clause(&self) -> Option { + support::child(&self.syntax) + } + #[inline] + pub fn is_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::IS_KW) + } + #[inline] + pub fn json_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::JSON_KW) + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct IsJsonArray { + pub(crate) syntax: SyntaxNode, +} +impl IsJsonArray { + #[inline] + pub fn json_keys_unique_clause(&self) -> Option { + support::child(&self.syntax) + } + #[inline] + pub fn array_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::ARRAY_KW) + } + #[inline] + pub fn is_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::IS_KW) + } + #[inline] + pub fn json_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::JSON_KW) + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct IsJsonObject { + pub(crate) syntax: SyntaxNode, +} +impl IsJsonObject { + #[inline] + pub fn json_keys_unique_clause(&self) -> Option { + support::child(&self.syntax) + } + #[inline] + pub fn is_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::IS_KW) + } + #[inline] + pub fn json_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::JSON_KW) + } + #[inline] + pub fn object_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::OBJECT_KW) + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct IsJsonScalar { + pub(crate) syntax: SyntaxNode, +} +impl IsJsonScalar { + #[inline] + pub fn json_keys_unique_clause(&self) -> Option { + support::child(&self.syntax) + } + #[inline] + pub fn is_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::IS_KW) + } + #[inline] + pub fn json_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::JSON_KW) + } + #[inline] + pub fn scalar_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::SCALAR_KW) + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct IsJsonValue { + pub(crate) syntax: SyntaxNode, +} +impl IsJsonValue { + #[inline] + pub fn json_keys_unique_clause(&self) -> Option { + support::child(&self.syntax) + } + #[inline] + pub fn is_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::IS_KW) + } + #[inline] + pub fn json_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::JSON_KW) + } + #[inline] + pub fn value_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::VALUE_KW) + } +} + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct IsNormalized { pub(crate) syntax: SyntaxNode, @@ -4996,6 +5107,137 @@ impl IsNotDistinctFrom { } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct IsNotJson { + pub(crate) syntax: SyntaxNode, +} +impl IsNotJson { + #[inline] + pub fn json_keys_unique_clause(&self) -> Option { + support::child(&self.syntax) + } + #[inline] + pub fn is_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::IS_KW) + } + #[inline] + pub fn json_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::JSON_KW) + } + #[inline] + pub fn not_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::NOT_KW) + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct IsNotJsonArray { + pub(crate) syntax: SyntaxNode, +} +impl IsNotJsonArray { + #[inline] + pub fn json_keys_unique_clause(&self) -> Option { + support::child(&self.syntax) + } + #[inline] + pub fn array_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::ARRAY_KW) + } + #[inline] + pub fn is_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::IS_KW) + } + #[inline] + pub fn json_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::JSON_KW) + } + #[inline] + pub fn not_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::NOT_KW) + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct IsNotJsonObject { + pub(crate) syntax: SyntaxNode, +} +impl IsNotJsonObject { + #[inline] + pub fn json_keys_unique_clause(&self) -> Option { + support::child(&self.syntax) + } + #[inline] + pub fn is_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::IS_KW) + } + #[inline] + pub fn json_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::JSON_KW) + } + #[inline] + pub fn not_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::NOT_KW) + } + #[inline] + pub fn object_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::OBJECT_KW) + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct IsNotJsonScalar { + pub(crate) syntax: SyntaxNode, +} +impl IsNotJsonScalar { + #[inline] + pub fn json_keys_unique_clause(&self) -> Option { + support::child(&self.syntax) + } + #[inline] + pub fn is_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::IS_KW) + } + #[inline] + pub fn json_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::JSON_KW) + } + #[inline] + pub fn not_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::NOT_KW) + } + #[inline] + pub fn scalar_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::SCALAR_KW) + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct IsNotJsonValue { + pub(crate) syntax: SyntaxNode, +} +impl IsNotJsonValue { + #[inline] + pub fn json_keys_unique_clause(&self) -> Option { + support::child(&self.syntax) + } + #[inline] + pub fn is_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::IS_KW) + } + #[inline] + pub fn json_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::JSON_KW) + } + #[inline] + pub fn not_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::NOT_KW) + } + #[inline] + pub fn value_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::VALUE_KW) + } +} + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct IsNotNormalized { pub(crate) syntax: SyntaxNode, @@ -5870,6 +6112,26 @@ impl Op { support::child(&self.syntax) } #[inline] + pub fn is_json(&self) -> Option { + support::child(&self.syntax) + } + #[inline] + pub fn is_json_array(&self) -> Option { + support::child(&self.syntax) + } + #[inline] + pub fn is_json_object(&self) -> Option { + support::child(&self.syntax) + } + #[inline] + pub fn is_json_scalar(&self) -> Option { + support::child(&self.syntax) + } + #[inline] + pub fn is_json_value(&self) -> Option { + support::child(&self.syntax) + } + #[inline] pub fn is_not(&self) -> Option { support::child(&self.syntax) } @@ -5878,6 +6140,22 @@ impl Op { support::child(&self.syntax) } #[inline] + pub fn is_not_json(&self) -> Option { + support::child(&self.syntax) + } + #[inline] + pub fn is_not_json_array(&self) -> Option { + support::child(&self.syntax) + } + #[inline] + pub fn is_not_json_scalar(&self) -> Option { + support::child(&self.syntax) + } + #[inline] + pub fn is_not_json_value(&self) -> Option { + support::child(&self.syntax) + } + #[inline] pub fn lteq(&self) -> Option { support::child(&self.syntax) } @@ -6873,6 +7151,21 @@ impl ReturnFuncOption { } } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct ReturningClause { + pub(crate) syntax: SyntaxNode, +} +impl ReturningClause { + #[inline] + pub fn target_list(&self) -> Option { + support::child(&self.syntax) + } + #[inline] + pub fn returning_token(&self) -> Option { + support::token(&self.syntax, SyntaxKind::RETURNING_KW) + } +} + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Revoke { pub(crate) syntax: SyntaxNode, @@ -7991,6 +8284,10 @@ pub struct Update { pub(crate) syntax: SyntaxNode, } impl Update { + #[inline] + pub fn returning_clause(&self) -> Option { + support::child(&self.syntax) + } #[inline] pub fn update_token(&self) -> Option { support::token(&self.syntax, SyntaxKind::UPDATE_KW) @@ -12818,6 +13115,96 @@ impl AstNode for IsDistinctFrom { &self.syntax } } +impl AstNode for IsJson { + #[inline] + fn can_cast(kind: SyntaxKind) -> bool { + kind == SyntaxKind::IS_JSON + } + #[inline] + fn cast(syntax: SyntaxNode) -> Option { + if Self::can_cast(syntax.kind()) { + Some(Self { syntax }) + } else { + None + } + } + #[inline] + fn syntax(&self) -> &SyntaxNode { + &self.syntax + } +} +impl AstNode for IsJsonArray { + #[inline] + fn can_cast(kind: SyntaxKind) -> bool { + kind == SyntaxKind::IS_JSON_ARRAY + } + #[inline] + fn cast(syntax: SyntaxNode) -> Option { + if Self::can_cast(syntax.kind()) { + Some(Self { syntax }) + } else { + None + } + } + #[inline] + fn syntax(&self) -> &SyntaxNode { + &self.syntax + } +} +impl AstNode for IsJsonObject { + #[inline] + fn can_cast(kind: SyntaxKind) -> bool { + kind == SyntaxKind::IS_JSON_OBJECT + } + #[inline] + fn cast(syntax: SyntaxNode) -> Option { + if Self::can_cast(syntax.kind()) { + Some(Self { syntax }) + } else { + None + } + } + #[inline] + fn syntax(&self) -> &SyntaxNode { + &self.syntax + } +} +impl AstNode for IsJsonScalar { + #[inline] + fn can_cast(kind: SyntaxKind) -> bool { + kind == SyntaxKind::IS_JSON_SCALAR + } + #[inline] + fn cast(syntax: SyntaxNode) -> Option { + if Self::can_cast(syntax.kind()) { + Some(Self { syntax }) + } else { + None + } + } + #[inline] + fn syntax(&self) -> &SyntaxNode { + &self.syntax + } +} +impl AstNode for IsJsonValue { + #[inline] + fn can_cast(kind: SyntaxKind) -> bool { + kind == SyntaxKind::IS_JSON_VALUE + } + #[inline] + fn cast(syntax: SyntaxNode) -> Option { + if Self::can_cast(syntax.kind()) { + Some(Self { syntax }) + } else { + None + } + } + #[inline] + fn syntax(&self) -> &SyntaxNode { + &self.syntax + } +} impl AstNode for IsNormalized { #[inline] fn can_cast(kind: SyntaxKind) -> bool { @@ -12872,6 +13259,96 @@ impl AstNode for IsNotDistinctFrom { &self.syntax } } +impl AstNode for IsNotJson { + #[inline] + fn can_cast(kind: SyntaxKind) -> bool { + kind == SyntaxKind::IS_NOT_JSON + } + #[inline] + fn cast(syntax: SyntaxNode) -> Option { + if Self::can_cast(syntax.kind()) { + Some(Self { syntax }) + } else { + None + } + } + #[inline] + fn syntax(&self) -> &SyntaxNode { + &self.syntax + } +} +impl AstNode for IsNotJsonArray { + #[inline] + fn can_cast(kind: SyntaxKind) -> bool { + kind == SyntaxKind::IS_NOT_JSON_ARRAY + } + #[inline] + fn cast(syntax: SyntaxNode) -> Option { + if Self::can_cast(syntax.kind()) { + Some(Self { syntax }) + } else { + None + } + } + #[inline] + fn syntax(&self) -> &SyntaxNode { + &self.syntax + } +} +impl AstNode for IsNotJsonObject { + #[inline] + fn can_cast(kind: SyntaxKind) -> bool { + kind == SyntaxKind::IS_NOT_JSON_OBJECT + } + #[inline] + fn cast(syntax: SyntaxNode) -> Option { + if Self::can_cast(syntax.kind()) { + Some(Self { syntax }) + } else { + None + } + } + #[inline] + fn syntax(&self) -> &SyntaxNode { + &self.syntax + } +} +impl AstNode for IsNotJsonScalar { + #[inline] + fn can_cast(kind: SyntaxKind) -> bool { + kind == SyntaxKind::IS_NOT_JSON_SCALAR + } + #[inline] + fn cast(syntax: SyntaxNode) -> Option { + if Self::can_cast(syntax.kind()) { + Some(Self { syntax }) + } else { + None + } + } + #[inline] + fn syntax(&self) -> &SyntaxNode { + &self.syntax + } +} +impl AstNode for IsNotJsonValue { + #[inline] + fn can_cast(kind: SyntaxKind) -> bool { + kind == SyntaxKind::IS_NOT_JSON_VALUE + } + #[inline] + fn cast(syntax: SyntaxNode) -> Option { + if Self::can_cast(syntax.kind()) { + Some(Self { syntax }) + } else { + None + } + } + #[inline] + fn syntax(&self) -> &SyntaxNode { + &self.syntax + } +} impl AstNode for IsNotNormalized { #[inline] fn can_cast(kind: SyntaxKind) -> bool { @@ -14708,6 +15185,24 @@ impl AstNode for ReturnFuncOption { &self.syntax } } +impl AstNode for ReturningClause { + #[inline] + fn can_cast(kind: SyntaxKind) -> bool { + kind == SyntaxKind::RETURNING_CLAUSE + } + #[inline] + fn cast(syntax: SyntaxNode) -> Option { + if Self::can_cast(syntax.kind()) { + Some(Self { syntax }) + } else { + None + } + } + #[inline] + fn syntax(&self) -> &SyntaxNode { + &self.syntax + } +} impl AstNode for Revoke { #[inline] fn can_cast(kind: SyntaxKind) -> bool { diff --git a/crates/squawk_syntax/src/postgresql.ungram b/crates/squawk_syntax/src/postgresql.ungram index 4d9f15cd..7aa36402 100644 --- a/crates/squawk_syntax/src/postgresql.ungram +++ b/crates/squawk_syntax/src/postgresql.ungram @@ -34,7 +34,7 @@ ParamVariadic = 'variadic' ParamInOut = - 'in' 'out' + 'in' 'out' | 'inout' ParamIn = @@ -72,7 +72,7 @@ CallExpr = CastExpr = Expr ColonColon Type -ArrayExpr = +ArrayExpr = 'array' '[' (Expr (',' Expr)*) ']' | 'array' '(' Select ')' @@ -152,10 +152,10 @@ ColonEq = ColonColon = ':' ':' -Neq = +Neq = '!' '=' -SimilarTo = +SimilarTo = 'similar' 'to' AtTimeZone = @@ -165,7 +165,37 @@ IsNot = 'is' 'not' Op = -'or' | Gteq | '<' | '>' | FatArrow | '=' | 'in' | Neqb | Lteq | '+' | 'overlaps' | 'like' | 'ilike' | NotLike | NotIlike | NotIn | CustomOp | IsDistinctFrom | IsNotDistinctFrom | OperatorCall | 'is' | '^' | '%' | 'and' | '/' | Neq | 'collate' | '-' | ColonEq | ColonColon | 'value' | ':' | IsNot | SimilarTo | AtTimeZone +'or' | Gteq | '<' | '>' | FatArrow | '=' | 'in' | Neqb | Lteq | '+' | 'overlaps' | 'like' | 'ilike' | NotLike | NotIlike | NotIn | CustomOp | IsDistinctFrom | IsNotDistinctFrom | OperatorCall | 'is' | '^' | '%' | 'and' | '/' | Neq | 'collate' | '-' | ColonEq | ColonColon | 'value' | ':' | IsNot | SimilarTo | AtTimeZone | IsJson | IsJsonValue | IsNotJson | IsJsonObject | IsJsonArray |IsJsonScalar | IsNotJsonValue | IsJsonObject | IsNotJsonArray | IsNotJsonScalar + +IsJson = + 'is' 'json' JsonKeysUniqueClause? + +IsNotJson = + 'is' 'not' 'json' JsonKeysUniqueClause? + +IsNotJsonValue = + 'is' 'not' 'json' 'value' JsonKeysUniqueClause? + +IsNotJsonObject = + 'is' 'not' 'json' 'object' JsonKeysUniqueClause? + +IsNotJsonArray = + 'is' 'not' 'json' 'array' JsonKeysUniqueClause? + +IsNotJsonScalar = + 'is' 'not' 'json' 'scalar' JsonKeysUniqueClause? + +IsJsonValue = + 'is' 'json' 'value' JsonKeysUniqueClause? + +IsJsonObject = + 'is' 'json' 'object' JsonKeysUniqueClause? + +IsJsonArray = + 'is' 'json' 'array' JsonKeysUniqueClause? + +IsJsonScalar = + 'is' 'json' 'scalar' JsonKeysUniqueClause? BinExpr = lhs:Expr Op rhs:Expr @@ -210,13 +240,13 @@ BitType = DoubleType = 'double' 'precision' -TimeType = +TimeType = ('time' | 'timestamp') NameRef ('(' Literal ')')? (WithTimezone | WithoutTimezone)? -IntervalType = +IntervalType = 'interval' ( 'year' @@ -234,7 +264,7 @@ IntervalType = | 'minute' 'to' 'second' ) ('(' Literal ')')? - + Type = ArrayType @@ -263,9 +293,9 @@ Column = UniqueConstraint = ('constraint' NameRef) - 'unique' + 'unique' ( - UsingIndex + UsingIndex | ( 'nulls' 'not'? 'distinct' )? ColumnList ) @@ -315,7 +345,7 @@ MatchType = MatchFull | MatchPartial | MatchSimple - + ForeignKeyConstraint = 'foreign' 'key' from_columns:ColumnList 'references' Path to_columns:ColumnList @@ -380,8 +410,8 @@ GeneratedConstraint = ReferencesConstraint = ('constraint' NameRef) - 'references' Path '(' NameRef ')' - MatchType? + 'references' Path '(' NameRef ')' + MatchType? OnDeleteAction? OnUpdateAction? @@ -436,10 +466,10 @@ RelationName = 'only' ( '(' Path ')' | Path ) | Path '*' -TableList = +TableList = RelationName (',' RelationName)* -Truncate = +Truncate = 'truncate' 'table'? TableList ('restart' 'identity' | 'continue' 'identity')? ('cascade' | 'restrict')? @@ -506,7 +536,7 @@ Alias = SequenceOptionList = '(' ')' -ColumnList = +ColumnList = '(' ')' ConstraintIncludeClause = @@ -558,7 +588,7 @@ ReadCommitted = ReadUncommitted = 'read' 'uncommitted' -TransactionModeIsolationLevel = +TransactionModeIsolationLevel = 'isolation' 'level' ( Serializable | RepeatableRead | ReadCommitted | ReadUncommitted ) ReadWrite = @@ -598,7 +628,7 @@ CreateAggregate = IfExists = 'if' 'exists' - + DropType = 'drop' 'type' IfExists? (Path (',' Path)*) ('cascade' | 'restrict')? @@ -625,7 +655,7 @@ OrReplace = RetType = 'returns' Type - + BeginFuncOption = 'begin' 'atomic' 'end' @@ -655,12 +685,12 @@ FuncOption = -CreateFunction = +CreateFunction = 'create' OrReplace? 'function' Path ParamList RetType? option_list:FuncOptionList SetDefault = - 'set' 'default' Expr - + 'set' 'default' Expr + DropDefault = 'drop' 'default' @@ -670,7 +700,7 @@ SetNotNull = DropNotNull = 'drop' 'not' 'null' -NotValid = +NotValid = 'not' 'valid' Constraint = @@ -685,7 +715,7 @@ Constraint = | NotNullConstraint AddConstraint = - 'add' Constraint + 'add' Constraint DeferrableConstraintOption? NotDeferrableConstraintOption? InitiallyDeferredConstraintOption? @@ -698,7 +728,7 @@ AddConstraint = DropConstraint = 'drop' Constraint IfExists? NameRef ('restrict' | 'cascade')? -RenameConstraint = +RenameConstraint = 'rename' 'constraint' NameRef 'to' Name ValidateConstraint = @@ -735,7 +765,7 @@ AlterTable = Revoke = 'revoke' -Values = +Values = 'values' Table = @@ -746,6 +776,11 @@ Insert = Update = 'update' + ReturningClause? + +ReturningClause = + 'returning' + TargetList? Delete = 'delete' @@ -867,13 +902,13 @@ SelectInto = FilterClause? IntoClause = - 'into' + 'into' LockingClause = 'for' OrderByClause = - 'order' 'by' + 'order' 'by' FromItem = 'only'? @@ -886,10 +921,10 @@ ConstraintIndexMethod = 'using' ConstraintExclusions = - 'exclude' + 'exclude' ConstraintWhereClause = - 'where' + 'where' ExcludeConstraint = 'exclude' ConstraintIndexMethod? ConstraintExclusions @@ -898,7 +933,7 @@ WindowDef = '#ident'? ('partition' 'by' Expr)? AlterStatistics = - 'alter' 'statistics' NameRef + 'alter' 'statistics' NameRef AlterServer = 'alter' 'server' NameRef @@ -970,19 +1005,19 @@ AlterDefaultPrivileges = 'alter' 'default' 'privileges' AlterDatabase = - 'alter' 'database' NameRef + 'alter' 'database' NameRef AlterConversion = 'alter' 'conversion' NameRef AlterCollation = - 'alter' 'collation' NameRef + 'alter' 'collation' NameRef AlterAggregate = 'alter' 'aggregate' Aggregate AlterSubscription = - 'alter' 'subscription' NameRef + 'alter' 'subscription' NameRef AlterSystem = 'alter' 'system' 'set' @@ -1000,13 +1035,13 @@ AlterTextSearchConfiguration = 'alter' 'text' 'search' 'configuration' NameRef AlterTextSearchTemplate = - 'alter' 'text' 'search' 'template' NameRef + 'alter' 'text' 'search' 'template' NameRef AlterTrigger = 'alter' 'trigger' NameRef 'on' AlterType = - 'alter' 'type' Type + 'alter' 'type' Type AlterUser = 'alter' 'user' NameRef @@ -1061,7 +1096,7 @@ CreateLanguage = 'create' 'language' NameRef CreateOperator = - 'create' 'operator' + 'create' 'operator' CreateOperatorClass = 'create' 'operator' 'class' NameRef 'default'? 'for' 'type' Type 'using' NameRef @@ -1103,13 +1138,13 @@ CreateTextSearchParser = 'create' 'text' 'search' 'parser' NameRef CreateTextSearchDictionary = - 'create' 'text' 'search' 'dictionary' NameRef + 'create' 'text' 'search' 'dictionary' NameRef CreateTextSearchConfiguration = 'create' 'text' 'search' 'configuration' NameRef CreateTextSearchTemplate = - 'create' 'text' 'search' 'template' NameRef + 'create' 'text' 'search' 'template' NameRef CreateTransform = 'create' 'transform' 'for' Type 'language' NameRef @@ -1163,25 +1198,25 @@ DropExtension = 'drop' 'extension' IfExists? (NameRef (',' NameRef)*) DropMaterializedView = - 'drop' 'materialized' 'view' IfExists? + 'drop' 'materialized' 'view' IfExists? DropOperatorFamily = - 'drop' 'operator' 'family' IfExists? + 'drop' 'operator' 'family' IfExists? DropOperator = - 'drop' 'operator' IfExists? + 'drop' 'operator' IfExists? DropOperatorClass = - 'drop' 'operator' 'class' IfExists? NameRef 'using' + 'drop' 'operator' 'class' IfExists? NameRef 'using' DropOwned = - 'drop' 'owned' 'by' + 'drop' 'owned' 'by' DropPolicy = 'drop' 'policy' IfExists? NameRef 'on' DropProcedure = - 'drop' 'procedure' IfExists? + 'drop' 'procedure' IfExists? DropPublication = 'drop' 'publication' IfExists? (NameRef (',' NameRef)*) @@ -1217,13 +1252,13 @@ DropTextSearchConfig = 'drop' 'text' 'search' 'configuration' IfExists? DropTextSearchDict = - 'drop' 'text' 'search' 'dictionary' IfExists? + 'drop' 'text' 'search' 'dictionary' IfExists? DropTextSearchTemplate = - 'drop' 'text' 'search' 'template' IfExists? + 'drop' 'text' 'search' 'template' IfExists? DropTransform = - 'drop' 'transform' IfExists? + 'drop' 'transform' IfExists? DropUser = 'drop' 'user' IfExists? (NameRef (',' NameRef)*) @@ -1232,49 +1267,49 @@ DropUserMapping = 'drop' 'user' 'mapping' IfExists? 'for' NameRef 'server' NameRef DropView = - 'drop' 'view' IfExists? + 'drop' 'view' IfExists? Explain = - 'explain' + 'explain' ImportForeignSchema = - 'import' 'foreign' 'schema' NameRef + 'import' 'foreign' 'schema' NameRef Lock = - 'lock' 'table'? + 'lock' 'table'? Reassign = - 'reassign' + 'reassign' Refresh = 'refresh' 'materialized' 'view' 'concurrently'? NameRef 'with' 'data'? Grant = - 'grant' + 'grant' SecurityLabel = - 'security' 'label' + 'security' 'label' SetConstraints = - 'set' 'constraints' + 'set' 'constraints' SetRole = - 'set' 'role' + 'set' 'role' SetSessionAuth = 'set' 'session' 'authorization' SetTransaction = - 'set' 'transaction' + 'set' 'transaction' Reindex = - 'reindex' + 'reindex' CreateView = - 'create' 'view' NameRef + 'create' 'view' NameRef Prepare = - 'prepare' NameRef + 'prepare' NameRef Unlisten = 'unlisten' ('*' | NameRef) @@ -1286,7 +1321,7 @@ Deallocate = 'deallocate' ('prepare' NameRef | 'all') Load = - 'load' + 'load' Listen = 'listen' NameRef @@ -1298,43 +1333,43 @@ Discard = 'discard' ('all' | 'temp' | 'temporary' | 'plans' | 'sequences') Do = - 'do' + 'do' Move = - 'move' + 'move' Fetch = - 'fetch' + 'fetch' Close = - 'close' + 'close' Vacuum = - 'vacuum' + 'vacuum' Copy = 'copy' Call = - 'call' + 'call' CreateTrigger = - 'create' + 'create' DropSchema = 'drop' 'schema' IfExists? CreateSchema = - 'create' 'schema' + 'create' 'schema' DropTrigger = - 'drop' 'trigger' IfExists? NameRef 'on' + 'drop' 'trigger' IfExists? NameRef 'on' IndexParams = '(' ')' CreateType = - 'create' 'type' Type + 'create' 'type' Type CreateExtension = 'create' 'extension' @@ -1343,13 +1378,13 @@ Set = 'set' SetOptions Show = - 'show' + 'show' LanguageFuncOption = 'language' NameRef TransformFuncOption = - 'transform' + 'transform' WindowFuncOption = 'window' @@ -1373,22 +1408,22 @@ ParallelFuncOption = 'parallel' '#ident' CostFuncOption = - 'cost' + 'cost' RowsFuncOption = - 'rows' + 'rows' SupportFuncOption = - 'support' + 'support' SetFuncOption = - 'set' + 'set' AsFuncOption = 'as' (definition:Literal | obj_file:Literal ',' link_symbol:Literal) ReplicaIdentity = - 'replica' 'identity' + 'replica' 'identity' OfType = 'of' Type @@ -1403,55 +1438,55 @@ NoForceRls = 'no' 'force' 'row' 'level' 'security' Inherit = - 'inherit' + 'inherit' NoInherit = - 'no' 'inherit' + 'no' 'inherit' EnableTrigger = 'enable' 'trigger' EnableReplicaTrigger = - 'enable' 'replica' 'trigger' + 'enable' 'replica' 'trigger' EnableReplicaRule = - 'enable' 'replica' 'rule' + 'enable' 'replica' 'rule' EnableAlwaysTrigger = - 'enable' 'always' 'trigger' + 'enable' 'always' 'trigger' EnableAlwaysRule = - 'enable' 'always' 'rule' + 'enable' 'always' 'rule' EnableRule = - 'enable' 'rule' + 'enable' 'rule' EnableRls = 'enable' 'row' 'level' 'security' DisableTrigger = - 'disable' 'trigger' + 'disable' 'trigger' DisableRls = 'disable' 'row' 'level' 'security' DisableRule = - 'disable' 'rule' + 'disable' 'rule' ClusterOn = - 'cluster' 'on' + 'cluster' 'on' DetachPartition = - 'detach' 'partition' + 'detach' 'partition' DropColumn = - 'drop' 'column'? IfExists? + 'drop' 'column'? IfExists? AddColumn = 'add' 'column'? IfNotExists? NameRef Type Collate? (Constraint (',' Constraint)*)? AttachPartition = - 'attach' 'partition' + 'attach' 'partition' SetTablespace = 'set' 'tablespace' NameRef @@ -1481,7 +1516,7 @@ RenameTable = 'rename' 'to' NameRef RenameColumn = - 'rename' 'column'? + 'rename' 'column'? AlterColumnOption = DropDefault @@ -1510,13 +1545,13 @@ AlterColumn = 'alter' 'column'? option:AlterColumnOption Restart = - 'restart' 'with'? + 'restart' 'with'? SetSequenceOption = - 'set' + 'set' SetGenerated = - 'set' + 'set' DropExpression = 'drop' 'expression' IfExists? @@ -1525,7 +1560,7 @@ DropIdentity = 'drop' 'identity' IfExists? AddGenerated = - 'add' + 'add' ResetOptions = 'reset' '(' ')'