Add suppport for Show Objects statement for the Snowflake parser (#1702)

Co-authored-by: Denys Tsomenko <denys.tsomenko@caspiandb.com>
Co-authored-by: Ifeanyi Ubah <ify1992@yahoo.com>
This commit is contained in:
DanCodedThis 2025-02-06 19:11:02 +02:00 committed by GitHub
parent 443f492b4b
commit 0b8ba91156
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 97 additions and 2 deletions

View file

@ -3010,6 +3010,12 @@ pub enum Statement {
show_options: ShowStatementOptions,
},
/// ```sql
/// SHOW OBJECTS LIKE 'line%' IN mydb.public
/// ```
/// Snowflake-specific statement
/// <https://docs.snowflake.com/en/sql-reference/sql/show-objects>
ShowObjects(ShowObjects),
/// ```sql
/// SHOW TABLES
/// ```
ShowTables {
@ -4703,6 +4709,17 @@ impl fmt::Display for Statement {
)?;
Ok(())
}
Statement::ShowObjects(ShowObjects {
terse,
show_options,
}) => {
write!(
f,
"SHOW {terse}OBJECTS{show_options}",
terse = if *terse { "TERSE " } else { "" },
)?;
Ok(())
}
Statement::ShowTables {
terse,
history,
@ -8343,6 +8360,14 @@ impl fmt::Display for ShowStatementIn {
}
}
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
pub struct ShowObjects {
pub terse: bool,
pub show_options: ShowStatementOptions,
}
/// MSSQL's json null clause
///
/// ```plaintext