File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5188,6 +5188,19 @@ pub enum Statement {
51885188 object_name : ObjectName ,
51895189 } ,
51905190 /// ```sql
5191+ /// DESC | DESCRIBE RESULT <query_id>
5192+ /// ```
5193+ /// Snowflake-style `DESCRIBE RESULT '<query_id>'`, returning the column
5194+ /// metadata of a previously executed query's result set. The argument is a
5195+ /// general expression covering a string literal (`'01b...'`) and a function
5196+ /// call (`LAST_QUERY_ID()`).
5197+ DescribeResult {
5198+ /// `DESC` or `DESCRIBE`
5199+ describe_alias : DescribeAlias ,
5200+ /// The query-id argument.
5201+ query_id : Box < Expr > ,
5202+ } ,
5203+ /// ```sql
51915204 /// [EXPLAIN | DESC | DESCRIBE] <statement>
51925205 /// ```
51935206 Explain {
@@ -5726,6 +5739,12 @@ impl fmt::Display for Statement {
57265739 } => {
57275740 write ! ( f, "{describe_alias} {object_type} {object_name}" )
57285741 }
5742+ Statement :: DescribeResult {
5743+ describe_alias,
5744+ query_id,
5745+ } => {
5746+ write ! ( f, "{describe_alias} RESULT {query_id}" )
5747+ }
57295748 Statement :: Explain {
57305749 describe_alias,
57315750 verbose,
Original file line number Diff line number Diff line change @@ -472,6 +472,7 @@ impl Spanned for Statement {
472472 Statement :: Kill { .. } => Span :: empty ( ) ,
473473 Statement :: ExplainTable { .. } => Span :: empty ( ) ,
474474 Statement :: DescribeObject { .. } => Span :: empty ( ) ,
475+ Statement :: DescribeResult { .. } => Span :: empty ( ) ,
475476 Statement :: Explain { .. } => Span :: empty ( ) ,
476477 Statement :: Savepoint { .. } => Span :: empty ( ) ,
477478 Statement :: ReleaseSavepoint { .. } => Span :: empty ( ) ,
Original file line number Diff line number Diff line change @@ -14495,6 +14495,13 @@ impl<'a> Parser<'a> {
1449514495 if self.dialect.describe_requires_table_keyword()
1449614496 && matches!(describe_alias, DescribeAlias::Desc | DescribeAlias::Describe)
1449714497 {
14498+ if self.parse_keyword(Keyword::RESULT) {
14499+ let query_id = self.parse_expr()?;
14500+ return Ok(Statement::DescribeResult {
14501+ describe_alias,
14502+ query_id: Box::new(query_id),
14503+ });
14504+ }
1449814505 if let Some(kw) = self.parse_one_of_keywords(&[
1449914506 Keyword::TABLE,
1450014507 Keyword::VIEW,
You can’t perform that action at this time.
0 commit comments