Skip to content

Conversation

bombsimon
Copy link
Contributor

Although not documented under
https://docs.snowflake.com/en/sql-reference/sql/create-table, it is valid to put the IF NOT EXIST after the table name when creating a table for Snowflake.

This adds support to check for IF NOT EXIST again after parsing the table name if it wasn't found before the name.


I wish I could find some references of this, but sadly it's not that easy. Best I can do is to provide a screenshot from their UI executing a query with IF NOT EXIST after the table and show that it succeeds.

image

Although not documented under
https://docs.snowflake.com/en/sql-reference/sql/create-table, it is
valid to put the `IF NOT EXIST` _after_ the table name when creating a
table for Snowflake.

This adds support to check for `IF NOT EXIST` again after parsing the
table name if it wasn't found before the name.
@bombsimon
Copy link
Contributor Author

As seen by my second commit I just saw further down that this seems to be true for all Snowflake parameters so this basically just extends the existing loop that checks for parameters to include the IF NOT EXIST which can show up anywhere (even after the schema).

@bombsimon bombsimon requested a review from iffyio June 11, 2025 15:34
Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @bombsimon!
cc @alamb

@iffyio iffyio merged commit c2e83d4 into apache:main Jun 11, 2025
9 checks passed
@iffyio iffyio deleted the transient-table branch June 11, 2025 16:11
solontsev pushed a commit to solontsev/datafusion-sqlparser-rs that referenced this pull request Jun 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants