Skip to content

Commit d9d5e1b

Browse files
Snowflake: parse SHOW [TERSE] SEQUENCES [LIKE/IN ...]
1 parent af8b716 commit d9d5e1b

3 files changed

Lines changed: 32 additions & 0 deletions

File tree

src/ast/mod.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5095,6 +5095,15 @@ pub enum Statement {
50955095
show_options: ShowStatementOptions,
50965096
},
50975097
/// ```sql
5098+
/// SHOW [TERSE] SEQUENCES [ LIKE '<pattern>' ] [ IN ... ] ...
5099+
/// ```
5100+
ShowSequences {
5101+
/// Whether to show terse output.
5102+
terse: bool,
5103+
/// Options controlling the SHOW output (`LIKE` / `IN` / `LIMIT` / ...).
5104+
show_options: ShowStatementOptions,
5105+
},
5106+
/// ```sql
50985107
/// CREATE [OR REPLACE] ROW ACCESS POLICY [IF NOT EXISTS] <name>
50995108
/// AS (<args>) RETURNS BOOLEAN -> <body>
51005109
/// ```
@@ -7304,6 +7313,16 @@ impl fmt::Display for Statement {
73047313
terse = if *terse { "TERSE " } else { "" },
73057314
)
73067315
}
7316+
Statement::ShowSequences {
7317+
terse,
7318+
show_options,
7319+
} => {
7320+
write!(
7321+
f,
7322+
"SHOW {terse}SEQUENCES{show_options}",
7323+
terse = if *terse { "TERSE " } else { "" },
7324+
)
7325+
}
73077326
Statement::CreateRowAccessPolicy {
73087327
or_replace,
73097328
if_not_exists,

src/ast/spans.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,7 @@ impl Spanned for Statement {
554554
Statement::DescribeFileFormat { .. } => Span::empty(),
555555
Statement::ShowFileFormats { .. } => Span::empty(),
556556
Statement::ShowStages { .. } => Span::empty(),
557+
Statement::ShowSequences { .. } => Span::empty(),
557558
Statement::CreateRowAccessPolicy { .. } => Span::empty(),
558559
Statement::AlterRowAccessPolicy { .. } => Span::empty(),
559560
Statement::DropRowAccessPolicy { .. } => Span::empty(),

src/dialect/snowflake.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,9 @@ impl Dialect for SnowflakeDialect {
495495
if parser.parse_keyword(Keyword::STAGES) {
496496
return Some(parse_show_stages(terse, parser));
497497
}
498+
if parser.parse_keyword(Keyword::SEQUENCES) {
499+
return Some(parse_show_sequences(terse, parser));
500+
}
498501
if parser.parse_keywords(&[Keyword::ROW, Keyword::ACCESS, Keyword::POLICIES]) {
499502
return Some(parse_show_row_access_policies(parser));
500503
}
@@ -2566,6 +2569,15 @@ fn parse_show_stages(terse: bool, parser: &mut Parser) -> Result<Statement, Pars
25662569
})
25672570
}
25682571

2572+
/// Parse `SHOW [TERSE] SEQUENCES [ ... ]`
2573+
fn parse_show_sequences(terse: bool, parser: &mut Parser) -> Result<Statement, ParserError> {
2574+
let show_options = parser.parse_show_stmt_options()?;
2575+
Ok(Statement::ShowSequences {
2576+
terse,
2577+
show_options,
2578+
})
2579+
}
2580+
25692581
/// Parse `DESC[RIBE] WAREHOUSE <name>`
25702582
fn parse_describe_warehouse(parser: &mut Parser) -> Result<Statement, ParserError> {
25712583
let name = parser.parse_object_name(false)?;

0 commit comments

Comments
 (0)