Skip to content

support for SELECT TOP on snowflake#14

Merged
jmhain merged 1 commit intomainfrom
joey/sf-top-fix
Dec 12, 2023
Merged

support for SELECT TOP on snowflake#14
jmhain merged 1 commit intomainfrom
joey/sf-top-fix

Conversation

@jmhain
Copy link
Copy Markdown
Collaborator

@jmhain jmhain commented Dec 12, 2023

The parser currently accepts Snowflake SELECT TOP syntax, but then it renders it using MSSQL syntax (where the expression is parenthesized), which causes the resultant queries to fail in Snowflake with syntax errors. This PR fixes the issue.

Comment thread src/ast/query.rs
Comment on lines 660 to +661
pub percent: bool,
pub quantity: Option<Expr>,
pub quantity: Option<TopQuantity>,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nit: Would it make sense to encapsulate percent inside TopQuantity here given that fmt:Display only expects it when TopQuantity is set?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Maybe, though I usually try to keep the AST changes minimal since I plan to submit this upstream as well.

@jmhain jmhain merged commit 3286219 into main Dec 12, 2023
@jmhain jmhain deleted the joey/sf-top-fix branch December 12, 2023 22:02
jmhain added a commit that referenced this pull request Jan 18, 2024
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