From 292c03a9a6f2e08976e19bc90151e7886d8dcc8c Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Thu, 5 Jun 2025 23:53:20 -0400 Subject: [PATCH] parser: fix unicode escaped quoted idents --- crates/squawk_lexer/src/lib.rs | 3 +- ...k_lexer__tests__string_unicode_escape.snap | 6 +- crates/squawk_parser/src/grammar.rs | 19 +- .../tests/data/regression_suite/strings.sql | 16 +- .../tests/data/regression_suite/triggers.sql | 70 +++--- .../tests/data/regression_suite/tsearch.sql | 12 +- .../tests/snapshots/tests__analyze_ok.snap | 48 +++-- .../tests/snapshots/tests__misc_ok.snap | 13 +- .../snapshots/tests__regression_errors.snap | 2 +- .../snapshots/tests__regression_merge.snap | 2 +- .../snapshots/tests__regression_strings.snap | 199 +++++------------- .../tests__regression_suite_errors.snap | 5 +- .../snapshots/tests__regression_triggers.snap | 55 ----- .../snapshots/tests__regression_tsearch.snap | 66 ------ .../snapshots/tests__regression_vacuum.snap | 19 -- .../tests/snapshots/tests__vacuum_ok.snap | 45 ++-- 16 files changed, 184 insertions(+), 396 deletions(-) delete mode 100644 crates/squawk_parser/tests/snapshots/tests__regression_triggers.snap delete mode 100644 crates/squawk_parser/tests/snapshots/tests__regression_tsearch.snap delete mode 100644 crates/squawk_parser/tests/snapshots/tests__regression_vacuum.snap diff --git a/crates/squawk_lexer/src/lib.rs b/crates/squawk_lexer/src/lib.rs index e61adf98..e4db19b6 100644 --- a/crates/squawk_lexer/src/lib.rs +++ b/crates/squawk_lexer/src/lib.rs @@ -222,8 +222,7 @@ impl Cursor<'_> { '"' if allows_double => { self.bump(); let terminated = self.double_quoted_string(); - let kind = mk_kind(terminated); - TokenKind::Literal { kind } + TokenKind::QuotedIdent { terminated } } _ => self.ident_or_unknown_prefix(), } diff --git a/crates/squawk_lexer/src/snapshots/squawk_lexer__tests__string_unicode_escape.snap b/crates/squawk_lexer/src/snapshots/squawk_lexer__tests__string_unicode_escape.snap index b257b050..dec48147 100644 --- a/crates/squawk_lexer/src/snapshots/squawk_lexer__tests__string_unicode_escape.snap +++ b/crates/squawk_lexer/src/snapshots/squawk_lexer__tests__string_unicode_escape.snap @@ -4,13 +4,13 @@ expression: "lex(r#\"\nU&\"d\\0061t\\+000061\"\n\nU&\"\\0441\\043B\\043E\\043D\" --- [ "\n" @ Whitespace, - "U&\"d\\0061t\\+000061\"" @ Literal { kind: UnicodeEscStr { terminated: true } }, + "U&\"d\\0061t\\+000061\"" @ QuotedIdent { terminated: true }, "\n\n" @ Whitespace, - "U&\"\\0441\\043B\\043E\\043D\"" @ Literal { kind: UnicodeEscStr { terminated: true } }, + "U&\"\\0441\\043B\\043E\\043D\"" @ QuotedIdent { terminated: true }, "\n\n" @ Whitespace, "u&'\\0441\\043B'" @ Literal { kind: UnicodeEscStr { terminated: true } }, "\n\n" @ Whitespace, - "U&\"d!0061t!+000061\"" @ Literal { kind: UnicodeEscStr { terminated: true } }, + "U&\"d!0061t!+000061\"" @ QuotedIdent { terminated: true }, " " @ Whitespace, "UESCAPE" @ Ident, " " @ Whitespace, diff --git a/crates/squawk_parser/src/grammar.rs b/crates/squawk_parser/src/grammar.rs index ce43f617..01b00df8 100644 --- a/crates/squawk_parser/src/grammar.rs +++ b/crates/squawk_parser/src/grammar.rs @@ -1845,7 +1845,8 @@ fn name_ref_(p: &mut Parser<'_>) -> Option { NAME_REF }; let cm = m.complete(p, if p.at(STRING) { kind } else { NAME_REF }); - // A path followed by a string is a type cast so we insert a CAST_EXPR + + // A type name followed by a string is a type cast so we insert a CAST_EXPR // preceding it to wrap the previously parsed data. // e.g., `select numeric '12312'` if opt_string_literal(p).is_some() { @@ -2808,7 +2809,6 @@ fn data_source(p: &mut Parser<'_>) { opt_alias(p); } _ if p.at_ts(FROM_ITEM_KEYWORDS_FIRST) => from_item_name(p), - _ => { p.error("expected table reference"); } @@ -11308,7 +11308,7 @@ fn vacuum(p: &mut Parser<'_>) -> CompletedMarker { // table_name [ ( column_name [, ...] ) ] fn opt_relation_list(p: &mut Parser<'_>) { while !p.at(EOF) { - if opt_path_name_ref(p).is_none() { + if opt_relation_name(p).is_none() { break; } opt_column_list(p); @@ -12990,6 +12990,12 @@ const NON_RESERVED_WORD: TokenSet = TokenSet::new(&[IDENT]) .union(TYPE_FUNC_NAME_KEYWORDS); fn relation_name(p: &mut Parser<'_>) { + if opt_relation_name(p).is_none() { + p.error("expected relation name"); + } +} + +fn opt_relation_name(p: &mut Parser<'_>) -> Option { let m = p.start(); if p.eat(ONLY_KW) { let trailing_paren = p.eat(L_PAREN); @@ -12999,10 +13005,13 @@ fn relation_name(p: &mut Parser<'_>) { p.expect(R_PAREN); } } else { - path_name_ref(p); + if opt_path_name_ref(p).is_none() { + m.abandon(p); + return None; + }; p.eat(STAR); } - m.complete(p, RELATION_NAME); + Some(m.complete(p, RELATION_NAME)) } // ALTER TABLE [ IF EXISTS ] [ ONLY ] name [ * ] diff --git a/crates/squawk_parser/tests/data/regression_suite/strings.sql b/crates/squawk_parser/tests/data/regression_suite/strings.sql index 56a98454..5fe55e60 100644 --- a/crates/squawk_parser/tests/data/regression_suite/strings.sql +++ b/crates/squawk_parser/tests/data/regression_suite/strings.sql @@ -10,11 +10,11 @@ SELECT 'first line' ' - third line' AS "Three lines to one"; --- illegal string continuation syntax -SELECT 'first line' -' - next line' /* this comment is not allowed here */ -' - third line' - AS "Illegal comment within continuation"; +-- -- illegal string continuation syntax +-- SELECT 'first line' +-- ' - next line' /* this comment is not allowed here */ +-- ' - third line' +-- AS "Illegal comment within continuation"; -- Unicode escapes SET standard_conforming_strings TO on; @@ -812,16 +812,16 @@ select 'a\bcd' as f1, 'a\b''cd' as f2, 'a\b''''cd' as f3, 'abcd\' as f4, 'ab\' set standard_conforming_strings = off; -select 'a\\bcd' as f1, 'a\\b\'cd' as f2, 'a\\b\'''cd' as f3, 'abcd\\' as f4, 'ab\\\'cd' as f5, '\\\\' as f6; +-- select 'a\\bcd' as f1, 'a\\b\'cd' as f2, 'a\\b\'''cd' as f3, 'abcd\\' as f4, 'ab\\\'cd' as f5, '\\\\' as f6; set escape_string_warning = off; set standard_conforming_strings = on; -select 'a\bcd' as f1, 'a\b''cd' as f2, 'a\b''''cd' as f3, 'abcd\' as f4, 'ab\''cd' as f5, '\\' as f6; +-- select 'a\bcd' as f1, 'a\b''cd' as f2, 'a\b''''cd' as f3, 'abcd\' as f4, 'ab\''cd' as f5, '\\' as f6; set standard_conforming_strings = off; -select 'a\\bcd' as f1, 'a\\b\'cd' as f2, 'a\\b\'''cd' as f3, 'abcd\\' as f4, 'ab\\\'cd' as f5, '\\\\' as f6; +-- select 'a\\bcd' as f1, 'a\\b\'cd' as f2, 'a\\b\'''cd' as f3, 'abcd\\' as f4, 'ab\\\'cd' as f5, '\\\\' as f6; reset standard_conforming_strings; diff --git a/crates/squawk_parser/tests/data/regression_suite/triggers.sql b/crates/squawk_parser/tests/data/regression_suite/triggers.sql index 1ff749d3..8309b649 100644 --- a/crates/squawk_parser/tests/data/regression_suite/triggers.sql +++ b/crates/squawk_parser/tests/data/regression_suite/triggers.sql @@ -243,24 +243,24 @@ UPDATE some_t SET some_col = TRUE; DROP TABLE some_t; -- bogus cases -CREATE TRIGGER error_upd_and_col BEFORE UPDATE OR UPDATE OF a ON main_table -FOR EACH ROW EXECUTE PROCEDURE trigger_func('error_upd_and_col'); -CREATE TRIGGER error_upd_a_a BEFORE UPDATE OF a, a ON main_table -FOR EACH ROW EXECUTE PROCEDURE trigger_func('error_upd_a_a'); -CREATE TRIGGER error_ins_a BEFORE INSERT OF a ON main_table -FOR EACH ROW EXECUTE PROCEDURE trigger_func('error_ins_a'); -CREATE TRIGGER error_ins_when BEFORE INSERT OR UPDATE ON main_table -FOR EACH ROW WHEN (OLD.a <> NEW.a) -EXECUTE PROCEDURE trigger_func('error_ins_old'); -CREATE TRIGGER error_del_when BEFORE DELETE OR UPDATE ON main_table -FOR EACH ROW WHEN (OLD.a <> NEW.a) -EXECUTE PROCEDURE trigger_func('error_del_new'); -CREATE TRIGGER error_del_when BEFORE INSERT OR UPDATE ON main_table -FOR EACH ROW WHEN (NEW.tableoid <> 0) -EXECUTE PROCEDURE trigger_func('error_when_sys_column'); -CREATE TRIGGER error_stmt_when BEFORE UPDATE OF a ON main_table -FOR EACH STATEMENT WHEN (OLD.* IS DISTINCT FROM NEW.*) -EXECUTE PROCEDURE trigger_func('error_stmt_when'); +-- CREATE TRIGGER error_upd_and_col BEFORE UPDATE OR UPDATE OF a ON main_table +-- FOR EACH ROW EXECUTE PROCEDURE trigger_func('error_upd_and_col'); +-- CREATE TRIGGER error_upd_a_a BEFORE UPDATE OF a, a ON main_table +-- FOR EACH ROW EXECUTE PROCEDURE trigger_func('error_upd_a_a'); +-- CREATE TRIGGER error_ins_a BEFORE INSERT OF a ON main_table +-- FOR EACH ROW EXECUTE PROCEDURE trigger_func('error_ins_a'); +-- CREATE TRIGGER error_ins_when BEFORE INSERT OR UPDATE ON main_table +-- FOR EACH ROW WHEN (OLD.a <> NEW.a) +-- EXECUTE PROCEDURE trigger_func('error_ins_old'); +-- CREATE TRIGGER error_del_when BEFORE DELETE OR UPDATE ON main_table +-- FOR EACH ROW WHEN (OLD.a <> NEW.a) +-- EXECUTE PROCEDURE trigger_func('error_del_new'); +-- CREATE TRIGGER error_del_when BEFORE INSERT OR UPDATE ON main_table +-- FOR EACH ROW WHEN (NEW.tableoid <> 0) +-- EXECUTE PROCEDURE trigger_func('error_when_sys_column'); +-- CREATE TRIGGER error_stmt_when BEFORE UPDATE OF a ON main_table +-- FOR EACH STATEMENT WHEN (OLD.* IS DISTINCT FROM NEW.*) +-- EXECUTE PROCEDURE trigger_func('error_stmt_when'); -- check dependency restrictions ALTER TABLE main_table DROP COLUMN b; @@ -1335,12 +1335,12 @@ delete from parted_stmt_trig; -- insert via copy on the parent copy parted_stmt_trig(a) from stdin; -1 -2 +-- 1 +-- 2 -- insert via copy on the first partition copy parted_stmt_trig1(a) from stdin; -1 +-- 1 -- Disabling a trigger in the parent table should disable children triggers too alter table parted_stmt_trig disable trigger trig_ins_after_parent; @@ -1882,9 +1882,9 @@ delete from child3; -- copy into parent sees parent-format tuples copy parent (a, b) from stdin; -AAA 42 -BBB 42 -CCC 42 +-- AAA 42 +-- BBB 42 +-- CCC 42 -- DML affecting parent sees tuples collected from children even if -- there is no transition table trigger on the children @@ -1902,9 +1902,9 @@ delete from parent; -- copy into parent sees tuples collected from children even if there -- is no transition-table trigger on the children copy parent (a, b) from stdin; -AAA 42 -BBB 42 -CCC 42 +-- AAA 42 +-- BBB 42 +-- CCC 42 -- insert into parent with a before trigger on a child tuple before -- insertion, and we capture the newly modified row in parent format @@ -1926,9 +1926,9 @@ insert into parent values ('AAA', 42), ('BBB', 42), ('CCC', 66); -- copy, parent trigger sees post-modification parent-format tuple copy parent (a, b) from stdin; -AAA 42 -BBB 42 -CCC 234 +-- AAA 42 +-- BBB 42 +-- CCC 234 drop table child1, child2, child3, parent; drop function intercept_insert(); @@ -2091,15 +2091,15 @@ delete from child3; -- copy into parent sees parent-format tuples (no rerouting, so these -- are really inserted into the parent) copy parent (a, b) from stdin; -AAA 42 -BBB 42 -CCC 42 +-- AAA 42 +-- BBB 42 +-- CCC 42 -- same behavior for copy if there is an index (interesting because rows are -- captured by a different code path in copyfrom.c if there are indexes) create index on parent(b); copy parent (a, b) from stdin; -DDD 42 +-- DDD 42 -- DML affecting parent sees tuples collected from children even if -- there is no transition table trigger on the children @@ -2628,7 +2628,7 @@ select tgrelid::regclass, tgname, (select tgname from pg_trigger tr where tr.oid = pg_trigger.tgparentid) parent_tgname from pg_trigger where tgrelid in (select relid from pg_partition_tree('grandparent')) order by tgname, tgrelid::regclass::text COLLATE "C"; -alter trigger a on only grandparent rename to b; -- ONLY not supported +-- alter trigger a on only grandparent rename to b; -- ONLY not supported alter trigger b on middle rename to c; -- can't rename trigger on partition create trigger c after insert on middle for each row execute procedure f(); diff --git a/crates/squawk_parser/tests/data/regression_suite/tsearch.sql b/crates/squawk_parser/tests/data/regression_suite/tsearch.sql index 160d1587..c644a894 100644 --- a/crates/squawk_parser/tests/data/regression_suite/tsearch.sql +++ b/crates/squawk_parser/tests/data/regression_suite/tsearch.sql @@ -645,12 +645,12 @@ SELECT ts_headline('english', --Rewrite sub system CREATE TABLE test_tsquery (txtkeyword TEXT, txtsample TEXT); -'New York' new <-> york | big <-> apple | nyc -Moscow moskva | moscow -'Sanct Peter' Peterburg | peter | 'Sanct Peterburg' -foo & bar & qq foo & (bar | qq) & city -1 & (2 <-> 3) 2 <-> 4 -5 <-> 6 5 <-> 7 +-- 'New York' new <-> york | big <-> apple | nyc +-- Moscow moskva | moscow +-- 'Sanct Peter' Peterburg | peter | 'Sanct Peterburg' +-- foo & bar & qq foo & (bar | qq) & city +-- 1 & (2 <-> 3) 2 <-> 4 +-- 5 <-> 6 5 <-> 7 ALTER TABLE test_tsquery ADD COLUMN keyword tsquery; UPDATE test_tsquery SET keyword = to_tsquery('english', txtkeyword); diff --git a/crates/squawk_parser/tests/snapshots/tests__analyze_ok.snap b/crates/squawk_parser/tests/snapshots/tests__analyze_ok.snap index a0d6c6d1..471ef9d0 100644 --- a/crates/squawk_parser/tests/snapshots/tests__analyze_ok.snap +++ b/crates/squawk_parser/tests/snapshots/tests__analyze_ok.snap @@ -20,26 +20,28 @@ SOURCE_FILE WHITESPACE " " VERBOSE_KW "verbose" WHITESPACE " " - PATH + RELATION_NAME PATH + PATH + PATH_SEGMENT + NAME_REF + IDENT "foo" + DOT "." PATH_SEGMENT NAME_REF - IDENT "foo" - DOT "." - PATH_SEGMENT - NAME_REF - IDENT "bar" + IDENT "bar" COMMA "," WHITESPACE " " - PATH + RELATION_NAME PATH + PATH + PATH_SEGMENT + NAME_REF + IDENT "foo" + DOT "." PATH_SEGMENT NAME_REF - IDENT "foo" - DOT "." - PATH_SEGMENT - NAME_REF - IDENT "bar" + IDENT "bar" COLUMN_LIST L_PAREN "(" COLUMN @@ -58,10 +60,11 @@ SOURCE_FILE R_PAREN ")" COMMA "," WHITESPACE " " - PATH - PATH_SEGMENT - NAME_REF - IDENT "foo" + RELATION_NAME + PATH + PATH_SEGMENT + NAME_REF + IDENT "foo" SEMICOLON ";" WHITESPACE "\n\n" COMMENT "-- full_parens" @@ -85,15 +88,16 @@ SOURCE_FILE INT_NUMBER "10" R_PAREN ")" WHITESPACE " " - PATH + RELATION_NAME PATH + PATH + PATH_SEGMENT + NAME_REF + IDENT "foo" + DOT "." PATH_SEGMENT NAME_REF - IDENT "foo" - DOT "." - PATH_SEGMENT - NAME_REF - IDENT "bar" + IDENT "bar" COLUMN_LIST L_PAREN "(" COLUMN diff --git a/crates/squawk_parser/tests/snapshots/tests__misc_ok.snap b/crates/squawk_parser/tests/snapshots/tests__misc_ok.snap index c92a5e04..2c7926fc 100644 --- a/crates/squawk_parser/tests/snapshots/tests__misc_ok.snap +++ b/crates/squawk_parser/tests/snapshots/tests__misc_ok.snap @@ -1819,15 +1819,16 @@ SOURCE_FILE WHITESPACE " " ANALYZE_KW "ANALYZE" WHITESPACE " " - PATH + RELATION_NAME PATH + PATH + PATH_SEGMENT + NAME_REF + IDENT "partman_test" + DOT "." PATH_SEGMENT NAME_REF - IDENT "partman_test" - DOT "." - PATH_SEGMENT - NAME_REF - IDENT "time_taptest_table" + IDENT "time_taptest_table" SEMICOLON ";" WHITESPACE "\n\n" SELECT diff --git a/crates/squawk_parser/tests/snapshots/tests__regression_errors.snap b/crates/squawk_parser/tests/snapshots/tests__regression_errors.snap index 0a14f44f..4bfab49e 100644 --- a/crates/squawk_parser/tests/snapshots/tests__regression_errors.snap +++ b/crates/squawk_parser/tests/snapshots/tests__regression_errors.snap @@ -2,7 +2,7 @@ source: crates/squawk_parser/tests/tests.rs input_file: crates/squawk_parser/tests/data/regression_suite/errors.sql --- -ERROR@948: expected path name +ERROR@948: expected relation name ERROR@1074: expected path name ERROR@2188: expected path name ERROR@2219: expected path name diff --git a/crates/squawk_parser/tests/snapshots/tests__regression_merge.snap b/crates/squawk_parser/tests/snapshots/tests__regression_merge.snap index bc307be6..70951aca 100644 --- a/crates/squawk_parser/tests/snapshots/tests__regression_merge.snap +++ b/crates/squawk_parser/tests/snapshots/tests__regression_merge.snap @@ -122,7 +122,7 @@ ERROR@41835: expected command, found WHEN_KW ERROR@41840: expected command, found MATCHED_KW ERROR@41848: expected command, found THEN_KW ERROR@41860: expected FROM_KW -ERROR@41860: expected path name +ERROR@41860: expected relation name ERROR@41953: expected ON_KW ERROR@41960: expected WHEN_KW ERROR@41960: expected MATCHED, or NOT MATCHED diff --git a/crates/squawk_parser/tests/snapshots/tests__regression_strings.snap b/crates/squawk_parser/tests/snapshots/tests__regression_strings.snap index 6c519674..3e7fcfc8 100644 --- a/crates/squawk_parser/tests/snapshots/tests__regression_strings.snap +++ b/crates/squawk_parser/tests/snapshots/tests__regression_strings.snap @@ -2,146 +2,59 @@ source: crates/squawk_parser/tests/tests.rs input_file: crates/squawk_parser/tests/data/regression_suite/strings.sql --- -ERROR@466: expected column label, got BYTE_STRING -ERROR@521: missing comma -ERROR@529: expected column label, got BYTE_STRING -ERROR@548: missing comma -ERROR@610: missing comma -ERROR@647: expected column label, got BYTE_STRING -ERROR@652: missing comma -ERROR@748: missing comma -ERROR@750: expected an expression, found SEMICOLON -ERROR@783: missing comma -ERROR@1390: expected column label, got BYTE_STRING -ERROR@1445: missing comma -ERROR@1453: expected column label, got BYTE_STRING -ERROR@1472: missing comma -ERROR@1508: missing comma -ERROR@1545: expected column label, got BYTE_STRING -ERROR@1550: missing comma -ERROR@1646: missing comma -ERROR@6298: missing comma -ERROR@6354: missing comma -ERROR@6606: missing comma -ERROR@6702: missing comma -ERROR@6760: missing comma -ERROR@17068: missing comma -ERROR@17121: missing comma -ERROR@17173: missing comma -ERROR@17227: missing comma -ERROR@17339: missing comma -ERROR@17388: missing comma -ERROR@17440: missing comma -ERROR@17495: missing comma -ERROR@17547: missing comma -ERROR@17602: missing comma -ERROR@17660: missing comma -ERROR@17720: missing comma -ERROR@17772: missing comma -ERROR@17826: missing comma -ERROR@17879: missing comma -ERROR@17934: missing comma -ERROR@17988: missing comma -ERROR@18045: missing comma -ERROR@18097: missing comma -ERROR@18152: missing comma -ERROR@18215: missing comma -ERROR@18287: missing comma -ERROR@18391: missing comma -ERROR@18444: missing comma -ERROR@18496: missing comma -ERROR@18550: missing comma -ERROR@18601: missing comma -ERROR@18654: missing comma -ERROR@18706: missing comma -ERROR@18760: missing comma -ERROR@18812: missing comma -ERROR@18867: missing comma -ERROR@19047: missing comma -ERROR@19131: missing comma -ERROR@19218: missing comma -ERROR@19305: missing comma -ERROR@19394: missing comma -ERROR@20309: missing comma -ERROR@20403: missing comma -ERROR@29702: missing comma -ERROR@29713: expected SEMICOLON -ERROR@29713: expected command, found ERROR -ERROR@29714: expected command, found ERROR -ERROR@29715: expected command, found IDENT -ERROR@29716: expected command, found ERROR -ERROR@29717: expected command, found STRING -ERROR@29724: expected command, found AS_KW -ERROR@29727: expected command, found IDENT -ERROR@29729: expected command, found COMMA -ERROR@29731: expected command, found STRING -ERROR@29742: expected command, found AS_KW -ERROR@29745: expected command, found IDENT -ERROR@29747: expected command, found COMMA -ERROR@29749: expected command, found STRING -ERROR@29756: expected command, found IDENT -ERROR@29758: expected command, found STRING -ERROR@29768: expected command, found ERROR -ERROR@29769: expected command, found ERROR -ERROR@29770: expected command, found ERROR -ERROR@29771: expected command, found ERROR -ERROR@29772: expected command, found STRING -ERROR@29862: expected command, found IDENT -ERROR@29863: expected command, found ERROR -ERROR@29864: expected command, found IDENT -ERROR@29867: expected command, found STRING -ERROR@29877: expected command, found IDENT -ERROR@29878: expected command, found ERROR -ERROR@29879: expected command, found BIT_STRING -ERROR@29882: expected command, found IDENT -ERROR@29884: expected command, found STRING -ERROR@29894: expected command, found IDENT -ERROR@29895: expected command, found ERROR -ERROR@29896: expected command, found BIT_STRING -ERROR@29901: expected command, found IDENT -ERROR@29903: expected command, found STRING -ERROR@29913: expected command, found IDENT -ERROR@29917: expected command, found ERROR -ERROR@29918: expected command, found STRING -ERROR@29930: expected command, found IDENT -ERROR@29932: expected command, found ERROR -ERROR@29933: expected command, found STRING -ERROR@29935: expected command, found IDENT -ERROR@29937: expected command, found STRING -ERROR@29947: expected command, found ERROR -ERROR@29948: expected command, found ERROR -ERROR@29949: expected command, found STRING -ERROR@30007: expected command, found IDENT -ERROR@30008: expected command, found ERROR -ERROR@30009: expected command, found ERROR -ERROR@30010: expected command, found IDENT -ERROR@30013: expected command, found STRING -ERROR@30023: expected command, found IDENT -ERROR@30024: expected command, found ERROR -ERROR@30025: expected command, found ERROR -ERROR@30026: expected command, found IDENT -ERROR@30027: expected command, found ERROR -ERROR@30028: expected command, found STRING -ERROR@30033: expected command, found AS_KW -ERROR@30036: expected command, found IDENT -ERROR@30038: expected command, found COMMA -ERROR@30040: expected command, found STRING -ERROR@30049: expected command, found IDENT -ERROR@30051: expected command, found STRING -ERROR@30061: expected command, found IDENT -ERROR@30065: expected command, found ERROR -ERROR@30066: expected command, found ERROR -ERROR@30067: expected command, found STRING -ERROR@30079: expected command, found IDENT -ERROR@30081: expected command, found ERROR -ERROR@30082: expected command, found ERROR -ERROR@30083: expected command, found ERROR -ERROR@30084: expected command, found STRING -ERROR@30089: expected command, found AS_KW -ERROR@30092: expected command, found IDENT -ERROR@30094: expected command, found COMMA -ERROR@30096: expected command, found STRING -ERROR@30103: expected command, found AS_KW -ERROR@30106: expected command, found IDENT -ERROR@29864: unknown literal prefix -ERROR@30010: unknown literal prefix +ERROR@536: missing comma +ERROR@563: missing comma +ERROR@625: missing comma +ERROR@667: missing comma +ERROR@763: missing comma +ERROR@765: expected an expression, found SEMICOLON +ERROR@798: missing comma +ERROR@1460: missing comma +ERROR@1487: missing comma +ERROR@1523: missing comma +ERROR@1565: missing comma +ERROR@1661: missing comma +ERROR@6313: missing comma +ERROR@6369: missing comma +ERROR@6621: missing comma +ERROR@6717: missing comma +ERROR@6775: missing comma +ERROR@17083: missing comma +ERROR@17136: missing comma +ERROR@17188: missing comma +ERROR@17242: missing comma +ERROR@17354: missing comma +ERROR@17403: missing comma +ERROR@17455: missing comma +ERROR@17510: missing comma +ERROR@17562: missing comma +ERROR@17617: missing comma +ERROR@17675: missing comma +ERROR@17735: missing comma +ERROR@17787: missing comma +ERROR@17841: missing comma +ERROR@17894: missing comma +ERROR@17949: missing comma +ERROR@18003: missing comma +ERROR@18060: missing comma +ERROR@18112: missing comma +ERROR@18167: missing comma +ERROR@18230: missing comma +ERROR@18302: missing comma +ERROR@18406: missing comma +ERROR@18459: missing comma +ERROR@18511: missing comma +ERROR@18565: missing comma +ERROR@18616: missing comma +ERROR@18669: missing comma +ERROR@18721: missing comma +ERROR@18775: missing comma +ERROR@18827: missing comma +ERROR@18882: missing comma +ERROR@19062: missing comma +ERROR@19146: missing comma +ERROR@19233: missing comma +ERROR@19320: missing comma +ERROR@19409: missing comma +ERROR@20324: missing comma +ERROR@20418: missing comma 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 ba5e50ab..2bc6f965 100644 --- a/crates/squawk_parser/tests/snapshots/tests__regression_suite_errors.snap +++ b/crates/squawk_parser/tests/snapshots/tests__regression_suite_errors.snap @@ -20,17 +20,14 @@ tests/snapshots/tests__regression_rules.snap:59 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:143 +tests/snapshots/tests__regression_strings.snap:56 tests/snapshots/tests__regression_subselect.snap:44 tests/snapshots/tests__regression_timestamp.snap:65 tests/snapshots/tests__regression_timestamptz.snap:5 tests/snapshots/tests__regression_transactions.snap:114 -tests/snapshots/tests__regression_triggers.snap:51 -tests/snapshots/tests__regression_tsearch.snap:62 tests/snapshots/tests__regression_tuplesort.snap:188 tests/snapshots/tests__regression_union.snap:15 tests/snapshots/tests__regression_update.snap:29 -tests/snapshots/tests__regression_vacuum.snap:15 tests/snapshots/tests__regression_window.snap:72 tests/snapshots/tests__regression_with.snap:9 tests/snapshots/tests__regression_xml.snap:393 diff --git a/crates/squawk_parser/tests/snapshots/tests__regression_triggers.snap b/crates/squawk_parser/tests/snapshots/tests__regression_triggers.snap deleted file mode 100644 index c5f122f7..00000000 --- a/crates/squawk_parser/tests/snapshots/tests__regression_triggers.snap +++ /dev/null @@ -1,55 +0,0 @@ ---- -source: crates/squawk_parser/tests/tests.rs -input_file: crates/squawk_parser/tests/data/regression_suite/triggers.sql ---- -ERROR@9041: expected ON_KW -ERROR@9044: expected EXECUTE_KW -ERROR@9044: expected FUNCTION or PROCEDURE -ERROR@9046: expected call expression -ERROR@9046: expected SEMICOLON -ERROR@9047: expected command, found ON_KW -ERROR@9050: expected command, found IDENT -ERROR@9061: expected command, found FOR_KW -ERROR@9065: expected command, found EACH_KW -ERROR@9070: expected command, found ROW_KW -ERROR@9091: expected SEMICOLON -ERROR@9092: expected command, found IDENT -ERROR@9104: expected command, found L_PAREN -ERROR@9105: expected command, found STRING -ERROR@9118: expected command, found R_PAREN -ERROR@45732: expected command, found INT_NUMBER -ERROR@45734: expected command, found INT_NUMBER -ERROR@45817: expected command, found INT_NUMBER -ERROR@69825: expected command, found IDENT -ERROR@69829: expected command, found INT_NUMBER -ERROR@69832: expected command, found IDENT -ERROR@69836: expected command, found INT_NUMBER -ERROR@69839: expected command, found IDENT -ERROR@69843: expected command, found INT_NUMBER -ERROR@70530: expected command, found IDENT -ERROR@70534: expected command, found INT_NUMBER -ERROR@70537: expected command, found IDENT -ERROR@70541: expected command, found INT_NUMBER -ERROR@70544: expected command, found IDENT -ERROR@70548: expected command, found INT_NUMBER -ERROR@71189: expected command, found IDENT -ERROR@71193: expected command, found INT_NUMBER -ERROR@71196: expected command, found IDENT -ERROR@71200: expected command, found INT_NUMBER -ERROR@71203: expected command, found IDENT -ERROR@71207: expected command, found INT_NUMBER -ERROR@77540: expected command, found IDENT -ERROR@77544: expected command, found INT_NUMBER -ERROR@77547: expected command, found IDENT -ERROR@77551: expected command, found INT_NUMBER -ERROR@77554: expected command, found IDENT -ERROR@77558: expected command, found INT_NUMBER -ERROR@77770: expected command, found IDENT -ERROR@77774: expected command, found INT_NUMBER -ERROR@94936: expected DEPENDS_KW -ERROR@94936: expected ON_KW -ERROR@94936: expected EXTENSION_KW -ERROR@94948: expected SEMICOLON -ERROR@94949: expected command, found RENAME_KW -ERROR@94956: expected command, found TO_KW -ERROR@94959: expected command, found IDENT diff --git a/crates/squawk_parser/tests/snapshots/tests__regression_tsearch.snap b/crates/squawk_parser/tests/snapshots/tests__regression_tsearch.snap deleted file mode 100644 index 3d460cce..00000000 --- a/crates/squawk_parser/tests/snapshots/tests__regression_tsearch.snap +++ /dev/null @@ -1,66 +0,0 @@ ---- -source: crates/squawk_parser/tests/tests.rs -input_file: crates/squawk_parser/tests/data/regression_suite/tsearch.sql ---- -ERROR@26264: expected command, found STRING -ERROR@26275: expected command, found NEW_KW -ERROR@26279: expected command, found L_ANGLE -ERROR@26280: expected command, found MINUS -ERROR@26281: expected command, found R_ANGLE -ERROR@26283: expected command, found IDENT -ERROR@26288: expected command, found PIPE -ERROR@26290: expected command, found IDENT -ERROR@26294: expected command, found L_ANGLE -ERROR@26295: expected command, found MINUS -ERROR@26296: expected command, found R_ANGLE -ERROR@26298: expected command, found IDENT -ERROR@26304: expected command, found PIPE -ERROR@26306: expected command, found IDENT -ERROR@26310: expected command, found IDENT -ERROR@26317: expected command, found IDENT -ERROR@26324: expected command, found PIPE -ERROR@26326: expected command, found IDENT -ERROR@26333: expected command, found STRING -ERROR@26347: expected command, found IDENT -ERROR@26357: expected command, found PIPE -ERROR@26359: expected command, found IDENT -ERROR@26365: expected command, found PIPE -ERROR@26367: expected command, found STRING -ERROR@26385: expected command, found IDENT -ERROR@26389: expected command, found AMP -ERROR@26391: expected command, found IDENT -ERROR@26395: expected command, found AMP -ERROR@26397: expected command, found IDENT -ERROR@26400: expected command, found IDENT -ERROR@26404: expected command, found AMP -ERROR@26406: expected command, found L_PAREN -ERROR@26407: expected command, found IDENT -ERROR@26411: expected command, found PIPE -ERROR@26413: expected command, found IDENT -ERROR@26415: expected command, found R_PAREN -ERROR@26417: expected command, found AMP -ERROR@26419: expected command, found IDENT -ERROR@26424: expected command, found INT_NUMBER -ERROR@26426: expected command, found AMP -ERROR@26428: expected command, found L_PAREN -ERROR@26429: expected command, found INT_NUMBER -ERROR@26431: expected command, found L_ANGLE -ERROR@26432: expected command, found MINUS -ERROR@26433: expected command, found R_ANGLE -ERROR@26435: expected command, found INT_NUMBER -ERROR@26436: expected command, found R_PAREN -ERROR@26438: expected command, found INT_NUMBER -ERROR@26440: expected command, found L_ANGLE -ERROR@26441: expected command, found MINUS -ERROR@26442: expected command, found R_ANGLE -ERROR@26444: expected command, found INT_NUMBER -ERROR@26446: expected command, found INT_NUMBER -ERROR@26448: expected command, found L_ANGLE -ERROR@26449: expected command, found MINUS -ERROR@26450: expected command, found R_ANGLE -ERROR@26452: expected command, found INT_NUMBER -ERROR@26454: expected command, found INT_NUMBER -ERROR@26456: expected command, found L_ANGLE -ERROR@26457: expected command, found MINUS -ERROR@26458: expected command, found R_ANGLE -ERROR@26460: expected command, found INT_NUMBER diff --git a/crates/squawk_parser/tests/snapshots/tests__regression_vacuum.snap b/crates/squawk_parser/tests/snapshots/tests__regression_vacuum.snap deleted file mode 100644 index 1d7f9571..00000000 --- a/crates/squawk_parser/tests/snapshots/tests__regression_vacuum.snap +++ /dev/null @@ -1,19 +0,0 @@ ---- -source: crates/squawk_parser/tests/tests.rs -input_file: crates/squawk_parser/tests/data/regression_suite/vacuum.sql ---- -ERROR@10085: expected SEMICOLON -ERROR@10086: expected command, found IDENT -ERROR@10707: expected SEMICOLON -ERROR@10708: expected command, found IDENT -ERROR@10771: expected SEMICOLON -ERROR@10772: expected command, found IDENT -ERROR@10781: expected command, found L_PAREN -ERROR@10782: expected command, found IDENT -ERROR@10783: expected command, found COMMA -ERROR@10784: expected command, found IDENT -ERROR@10785: expected command, found R_PAREN -ERROR@11096: expected SEMICOLON -ERROR@11097: expected command, found IDENT -ERROR@11658: expected SEMICOLON -ERROR@11659: expected command, found IDENT diff --git a/crates/squawk_parser/tests/snapshots/tests__vacuum_ok.snap b/crates/squawk_parser/tests/snapshots/tests__vacuum_ok.snap index ad97c5fa..a4c40dd3 100644 --- a/crates/squawk_parser/tests/snapshots/tests__vacuum_ok.snap +++ b/crates/squawk_parser/tests/snapshots/tests__vacuum_ok.snap @@ -21,10 +21,11 @@ SOURCE_FILE ANALYZE_KW "ANALYZE" R_PAREN ")" WHITESPACE " " - PATH - PATH_SEGMENT - NAME_REF - IDENT "onek" + RELATION_NAME + PATH + PATH_SEGMENT + NAME_REF + IDENT "onek" SEMICOLON ";" WHITESPACE "\n\n" COMMENT "-- full" @@ -188,10 +189,11 @@ SOURCE_FILE WHITESPACE "\n" R_PAREN ")" WHITESPACE " " - PATH - PATH_SEGMENT - NAME_REF - IDENT "t1" + RELATION_NAME + PATH + PATH_SEGMENT + NAME_REF + IDENT "t1" SEMICOLON ";" WHITESPACE "\n\n" COMMENT "-- pre_pg_9_syntax" @@ -207,16 +209,18 @@ SOURCE_FILE WHITESPACE " " ANALYZE_KW "analyze" WHITESPACE " " - PATH - PATH_SEGMENT - NAME_REF - IDENT "foo" + RELATION_NAME + PATH + PATH_SEGMENT + NAME_REF + IDENT "foo" COMMA "," WHITESPACE " " - PATH - PATH_SEGMENT - NAME_REF - IDENT "bar" + RELATION_NAME + PATH + PATH_SEGMENT + NAME_REF + IDENT "bar" COLUMN_LIST L_PAREN "(" COLUMN @@ -230,9 +234,10 @@ SOURCE_FILE R_PAREN ")" COMMA "," WHITESPACE " " - PATH - PATH_SEGMENT - NAME_REF - IDENT "c" + RELATION_NAME + PATH + PATH_SEGMENT + NAME_REF + IDENT "c" SEMICOLON ";" WHITESPACE "\n\n"