File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments