Skip to content

Commit b762150

Browse files
Snowflake: parse ALTER SCHEMA SET/UNSET TAG
1 parent 448678e commit b762150

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/dialect/snowflake.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,17 @@ impl Dialect for SnowflakeDialect {
310310
return Some(parse_alter_object_set_tags(parser, ObjectType::Database));
311311
}
312312

313+
// ALTER SCHEMA <name> { SET TAG | UNSET TAG } — intercept only the tag
314+
// form; every other ALTER SCHEMA form (RENAME TO, SET OPTIONS, SET
315+
// DEFAULT COLLATE, ADD/DROP REPLICA, OWNER TO) fails the closure and
316+
// falls through to the generic parse_alter_schema.
317+
if let Ok(Some(stmt)) = parser.maybe_parse(|p| {
318+
p.expect_keywords(&[Keyword::ALTER, Keyword::SCHEMA])?;
319+
parse_alter_object_set_tags(p, ObjectType::Schema)
320+
}) {
321+
return Some(Ok(stmt));
322+
}
323+
313324
if parser.parse_keywords(&[Keyword::ALTER, Keyword::STAGE]) {
314325
// ALTER STAGE
315326
return Some(parse_alter_stage(parser));

0 commit comments

Comments
 (0)