Skip to content

Commit ed4cb05

Browse files
committed
Tests done according to other SHOW statements
1 parent 20f02c1 commit ed4cb05

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

src/ast/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2971,7 +2971,7 @@ pub enum Statement {
29712971
/// <https://docs.snowflake.com/en/sql-reference/sql/show-objects>
29722972
ShowObjects {
29732973
terse: bool,
2974-
options: ShowStatementOptions,
2974+
show_options: ShowStatementOptions,
29752975
},
29762976
/// ```sql
29772977
/// SHOW TABLES

src/dialect/snowflake.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,11 +1129,11 @@ fn parse_column_tags(parser: &mut Parser, with: bool) -> Result<TagsColumnOption
11291129
fn parse_show_objects(terse: bool, parser: &mut Parser) -> Result<Statement, ParserError> {
11301130
//TODO: Copy some functionality of parse_show_stmt_options() into another function,
11311131
// since it has more statemtns that we sholdun'ts support
1132-
let options = parser.parse_show_stmt_options()?;
1132+
let show_options = parser.parse_show_stmt_options()?;
11331133
Ok(
11341134
Statement::ShowObjects {
11351135
terse,
1136-
options,
1136+
show_options,
11371137
}
11381138
)
11391139
}

tests/sqlparser_snowflake.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2955,6 +2955,25 @@ fn test_parse_show_schemas() {
29552955
snowflake().verified_stmt("SHOW SCHEMAS IN DATABASE STARTS WITH 'abc' LIMIT 20 FROM 'xyz'");
29562956
}
29572957

2958+
#[test]
2959+
fn test_parse_show_objects() {
2960+
//Only happy path for now
2961+
snowflake().verified_stmt("SHOW OBJECTS");
2962+
snowflake().verified_stmt("SHOW OBJECTS IN abc");
2963+
snowflake().verified_stmt("SHOW OBJECTS LIKE '%test%' IN abc");
2964+
snowflake().verified_stmt("SHOW OBJECTS IN ACCOUNT");
2965+
snowflake().verified_stmt("SHOW OBJECTS IN DATABASE");
2966+
snowflake().verified_stmt("SHOW OBJECTS IN DATABASE abc");
2967+
snowflake().verified_stmt("SHOW OBJECTS IN SCHEMA");
2968+
snowflake().verified_stmt("SHOW OBJECTS IN SCHEMA abc");
2969+
snowflake().verified_stmt("SHOW TERSE OBJECTS");
2970+
snowflake().verified_stmt("SHOW TERSE OBJECTS IN abc");
2971+
snowflake().verified_stmt("SHOW TERSE OBJECTS LIKE '%test%' IN abc");
2972+
snowflake().verified_stmt("SHOW TERSE OBJECTS LIKE '%test%' IN abc STARTS WITH 'b'");
2973+
snowflake().verified_stmt("SHOW TERSE OBJECTS LIKE '%test%' IN abc STARTS WITH 'b' LIMIT 10");
2974+
snowflake().verified_stmt("SHOW TERSE OBJECTS LIKE '%test%' IN abc STARTS WITH 'b' LIMIT 10 FROM 'x'");
2975+
}
2976+
29582977
#[test]
29592978
fn test_parse_show_tables() {
29602979
snowflake().verified_stmt("SHOW TABLES");

0 commit comments

Comments
 (0)