Snowflake: Support dollar quoted comments (#1755)

This commit is contained in:
Aleksei Piianin 2025-03-15 07:07:07 +01:00 committed by GitHub
parent f81aed6359
commit 10cf7c164e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 34 additions and 23 deletions

View file

@ -976,6 +976,21 @@ fn parse_sf_create_or_replace_with_comment_for_snowflake() {
}
}
#[test]
fn parse_sf_create_table_or_view_with_dollar_quoted_comment() {
// Snowflake transforms dollar quoted comments into a common comment in DDL representation of creation
snowflake()
.one_statement_parses_to(
r#"CREATE OR REPLACE TEMPORARY VIEW foo.bar.baz ("COL_1" COMMENT $$comment 1$$) COMMENT = $$view comment$$ AS (SELECT 1)"#,
r#"CREATE OR REPLACE TEMPORARY VIEW foo.bar.baz ("COL_1" COMMENT 'comment 1') COMMENT = 'view comment' AS (SELECT 1)"#
);
snowflake().one_statement_parses_to(
r#"CREATE TABLE my_table (a STRING COMMENT $$comment 1$$) COMMENT = $$table comment$$"#,
r#"CREATE TABLE my_table (a STRING COMMENT 'comment 1') COMMENT = 'table comment'"#,
);
}
#[test]
fn test_sf_derived_table_in_parenthesis() {
// Nesting a subquery in an extra set of parentheses is non-standard,