iffyio commented on code in PR #2327:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2327#discussion_r3159507212
##########
tests/sqlparser_snowflake.rs:
##########
@@ -4764,6 +4764,52 @@ fn test_snowflake_create_view_copy_grants() {
);
}
+#[test]
+fn test_snowflake_create_view_copy_grants_after_columns() {
+ // Snowflake's documented placement for `COPY GRANTS` on `CREATE VIEW` is
+ // *after* the column list. Display normalizes to the pre-columns form
+ // already supported, so use `one_statement_parses_to` to assert the
+ // post-columns input is accepted and the AST flag is set.
+ // <https://docs.snowflake.com/en/sql-reference/sql/create-view#syntax>
+ let cases = [
+ (
+ "CREATE OR REPLACE VIEW v (a, b) COPY GRANTS AS SELECT a, b FROM
t",
+ "CREATE OR REPLACE VIEW v COPY GRANTS (a, b) AS SELECT a, b FROM
t",
+ ),
+ (
+ "CREATE OR REPLACE SECURE VIEW v (a, b) COPY GRANTS AS SELECT a, b
FROM t",
+ "CREATE OR REPLACE SECURE VIEW v COPY GRANTS (a, b) AS SELECT a, b
FROM t",
+ ),
+ (
+ "CREATE MATERIALIZED VIEW v (a) COPY GRANTS AS SELECT a FROM t",
+ "CREATE MATERIALIZED VIEW v COPY GRANTS (a) AS SELECT a FROM t",
+ ),
+ ];
+ for (sql, parsed) in cases {
+ match snowflake().one_statement_parses_to(sql, parsed) {
+ Statement::CreateView(CreateView {
Review Comment:
we can drop the ast assertions in the tests
##########
tests/sqlparser_snowflake.rs:
##########
@@ -4764,6 +4764,52 @@ fn test_snowflake_create_view_copy_grants() {
);
}
+#[test]
+fn test_snowflake_create_view_copy_grants_after_columns() {
+ // Snowflake's documented placement for `COPY GRANTS` on `CREATE VIEW` is
+ // *after* the column list. Display normalizes to the pre-columns form
+ // already supported, so use `one_statement_parses_to` to assert the
+ // post-columns input is accepted and the AST flag is set.
+ // <https://docs.snowflake.com/en/sql-reference/sql/create-view#syntax>
Review Comment:
```suggestion
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]