Skip to content

Commit eb5031a

Browse files
Scope ALTER USER terminator test to dialects without ALTER ROLE synonym
1 parent 19daf7e commit eb5031a

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

tests/sqlparser_common.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18292,12 +18292,22 @@ fn key_value_option_statements_do_not_swallow_following_statement() {
1829218292
// terminator, otherwise any following statement fails to parse. This covers
1829318293
// every unparenthesized caller of `parse_key_value_options`: `CREATE USER`
1829418294
// and both `ALTER USER ... SET` forms.
18295+
18296+
// `CREATE USER` parses identically across all dialects.
18297+
let statements = all_dialects()
18298+
.parse_sql_statements("CREATE USER user1; SELECT 1")
18299+
.unwrap();
18300+
assert_eq!(statements.len(), 2);
18301+
18302+
// `ALTER USER ... SET` routes through the same key-value option list, but
18303+
// PostgreSQL parses `ALTER USER` as a synonym for `ALTER ROLE` (a different
18304+
// code path), so scope these to dialects that keep the Snowflake grammar.
18305+
let dialects = all_dialects_except(|d| d.supports_alter_user_as_alter_role());
1829518306
for sql in [
18296-
"CREATE USER user1; SELECT 1",
1829718307
"ALTER USER user1 SET x = 'y'; SELECT 1",
1829818308
"ALTER USER user1 SET TAG t = 'v'; SELECT 1",
1829918309
] {
18300-
let statements = all_dialects().parse_sql_statements(sql).unwrap();
18310+
let statements = dialects.parse_sql_statements(sql).unwrap();
1830118311
assert_eq!(statements.len(), 2, "{sql}");
1830218312
}
1830318313
}

0 commit comments

Comments
 (0)