Skip to content

Commit 0f90ecc

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/explain-codes
2 parents 7ae6b35 + cbe394e commit 0f90ecc

38 files changed

Lines changed: 22576 additions & 417 deletions

‎corpora/polyglot-check/expected_differences.toml‎

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,12 @@ marker = ",OBJECT("
757757
polyglot_errors = ["Expected RParen, got LParen ('(')"]
758758
note = "x::MAP(VARCHAR, OBJECT(k INT)) nests a structured OBJECT as the CAST form does"
759759

760+
[[fix]]
761+
id = "negative_autoincrement_step"
762+
marker = "INCREMENT-"
763+
polyglot_errors = ["Unexpected token: Dash"]
764+
note = "AUTOINCREMENT START <num> INCREMENT <num> takes a negative step, which counts down; polyglot's INCREMENT reads only an unsigned number"
765+
760766
[[fix]]
761767
id = "parenthesized_typed_lambda"
762768
marker = "varchar)->"
@@ -1226,6 +1232,18 @@ marker = "BEGIN"
12261232
sqlquack_node = "scripting_block"
12271233
note = "a Snowflake Scripting block parses into its declarations, statements and handlers; crates/sqlquack-syntax/tests/parser/test_scripting.rs pins the tree"
12281234

1235+
[[structured]]
1236+
id = "snowflake_create_stage"
1237+
marker = "STAGE"
1238+
sqlquack_node = "create_object"
1239+
note = "a Snowflake CREATE STAGE parses into a STAGE object with its properties, such as FILE_FORMAT = ( FORMAT_NAME = ... ); polyglot keeps it as raw text; crates/sqlquack-syntax/tests/parser/test_fixes.rs pins the tree"
1240+
1241+
[[structured]]
1242+
id = "snowflake_create_file_format"
1243+
marker = "FILEFORMAT"
1244+
sqlquack_node = "create_object"
1245+
note = "a Snowflake CREATE FILE FORMAT parses into a FILE FORMAT object with its modifier and options; polyglot keeps it as raw text; crates/sqlquack-syntax/tests/parser/test_fixes.rs pins the tree"
1246+
12291247
[[rejection]]
12301248
id = "snowflake_stage_reserved_name"
12311249
sql = "SELECT @select"
@@ -1302,3 +1320,112 @@ sql = "SELECT x::INTERVAL"
13021320
dialects = ["Snowflake"]
13031321
sqlquack_error = "Expected an interval field such as DAY or YEAR TO MONTH"
13041322
note = "Snowflake's INTERVAL type needs a field (recorded errno 1003 for CAST ( NULL AS INTERVAL ))"
1323+
1324+
[[rejection]]
1325+
id = "snowflake_list_function_call"
1326+
sql = "LIST(a)"
1327+
dialects = ["Snowflake"]
1328+
sqlquack_error = "Expected a stage after the command"
1329+
note = "Snowflake's LIST is a stage command; DuckDB's LIST(a) aggregate is no Snowflake statement, and LIST needs @stage first"
1330+
1331+
[[rejection]]
1332+
id = "snowflake_list_function_order_by"
1333+
sql = "LIST(a ORDER BY b)"
1334+
dialects = ["Snowflake"]
1335+
sqlquack_error = "Expected a stage after the command"
1336+
note = "Snowflake's LIST is a stage command; DuckDB's ordered LIST aggregate is no Snowflake statement, and LIST needs @stage first"
1337+
1338+
[[rejection]]
1339+
id = "snowflake_list_without_stage"
1340+
sql = "LIST"
1341+
dialects = ["Snowflake"]
1342+
sqlquack_error = "Expected a stage after the command"
1343+
note = "Snowflake's LIST needs the @stage it lists"
1344+
1345+
[[rejection]]
1346+
id = "snowflake_unpivot_reserved_value_column"
1347+
sql = "SELECT * FROM q UNPIVOT(values FOR quarter IN (b, c))"
1348+
dialects = ["Snowflake"]
1349+
sqlquack_error = "Expected a value column name in UNPIVOT"
1350+
note = "VALUES is a Snowflake reserved word, so it cannot name UNPIVOT's value column unquoted"
1351+
1352+
1353+
1354+
1355+
1356+
1357+
1358+
1359+
1360+
1361+
1362+
1363+
[[rejection]]
1364+
id = "snowflake_show_grants_for"
1365+
sql = "SHOW GRANTS FOR foo"
1366+
dialects = ["Snowflake"]
1367+
sqlquack_error = "Invalid expression / Unexpected token"
1368+
note = "SHOW GRANTS FOR <user> is MySQL's; Snowflake's SHOW GRANTS takes ON, TO, OF or IN, so FOR is refused"
1369+
1370+
[[rejection]]
1371+
id = "snowflake_int_precision_default_uuid"
1372+
sql = "CREATE TABLE z (a INT(11) DEFAULT UUID())"
1373+
dialects = ["Snowflake"]
1374+
sqlquack_error = "Snowflake's INT and INTEGER take no precision"
1375+
note = "Snowflake's INT is NUMBER(38, 0) with no precision: it refuses CREATE TABLE v1 ( v1 INT ( 1 ) ) ; with syntax error 1003"
1376+
1377+
[[rejection]]
1378+
id = "snowflake_int_precision_default_null_comment"
1379+
sql = "CREATE TABLE z (a INT(11) DEFAULT NULL COMMENT '客户id')"
1380+
dialects = ["Snowflake"]
1381+
sqlquack_error = "Snowflake's INT and INTEGER take no precision"
1382+
note = "Snowflake's INT is NUMBER(38, 0) with no precision: it refuses CREATE TABLE v1 ( v1 INT ( 1 ) ) ; with syntax error 1003"
1383+
1384+
[[rejection]]
1385+
id = "snowflake_int_precision_not_null_default"
1386+
sql = "CREATE TABLE z (a INT(11) NOT NULL DEFAULT 1)"
1387+
dialects = ["Snowflake"]
1388+
sqlquack_error = "Snowflake's INT and INTEGER take no precision"
1389+
note = "Snowflake's INT is NUMBER(38, 0) with no precision: it refuses CREATE TABLE v1 ( v1 INT ( 1 ) ) ; with syntax error 1003"
1390+
1391+
[[rejection]]
1392+
id = "snowflake_int_precision_not_null_default_negative"
1393+
sql = "CREATE TABLE z (a INT(11) NOT NULL DEFAULT -1)"
1394+
dialects = ["Snowflake"]
1395+
sqlquack_error = "Snowflake's INT and INTEGER take no precision"
1396+
note = "Snowflake's INT is NUMBER(38, 0) with no precision: it refuses CREATE TABLE v1 ( v1 INT ( 1 ) ) ; with syntax error 1003"
1397+
1398+
[[rejection]]
1399+
id = "snowflake_int_precision_collate_auto_increment"
1400+
sql = "CREATE TABLE z (a INT(11) NOT NULL COLLATE utf8_bin AUTO_INCREMENT)"
1401+
dialects = ["Snowflake"]
1402+
sqlquack_error = "Snowflake's INT and INTEGER take no precision"
1403+
note = "Snowflake's INT is NUMBER(38, 0) with no precision: it refuses CREATE TABLE v1 ( v1 INT ( 1 ) ) ; with syntax error 1003"
1404+
1405+
[[rejection]]
1406+
id = "snowflake_view_without_query_columns"
1407+
sql = "CREATE VIEW z (a, b)"
1408+
dialects = ["Snowflake"]
1409+
sqlquack_error = "Expected AS and the view's query"
1410+
note = "a Snowflake view needs AS and its query; this is a column list with no query"
1411+
1412+
[[rejection]]
1413+
id = "snowflake_view_without_query_column_comments"
1414+
sql = "CREATE VIEW z (a, b COMMENT 'b', c COMMENT 'c')"
1415+
dialects = ["Snowflake"]
1416+
sqlquack_error = "Expected AS and the view's query"
1417+
note = "a Snowflake view needs AS and its query; this is a commented column list with no query"
1418+
1419+
[[rejection]]
1420+
id = "snowflake_merge_insert_star"
1421+
sql = "\n MERGE INTO target USING source ON target.id = source.id\n WHEN MATCHED THEN UPDATE *\n WHEN NOT MATCHED THEN INSERT *\n "
1422+
dialects = ["Snowflake"]
1423+
sqlquack_error = "Expected VALUES in MERGE INSERT"
1424+
note = "Snowflake's MERGE INSERT takes VALUES ( ... ) and refuses an INSERT without VALUES with syntax error 1003; INSERT * is Databricks'"
1425+
1426+
[[rejection]]
1427+
id = "snowflake_view_row_access_policy_without_on"
1428+
sql = "CREATE VIEW v WITH ROW ACCESS POLICY #unknown_policy AS SELECT 1"
1429+
dialects = ["Snowflake"]
1430+
sqlquack_error = "Expected On"
1431+
note = "a Snowflake view's ROW ACCESS POLICY reads <name> ON ( <column> , ... ); this one has no ON list and names the policy with sqlglot's #unknown placeholder"

0 commit comments

Comments
 (0)