Skip to content

SET with a list of comma separated assignments #1757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Mar 12, 2025

Conversation

MohamedAbdeen21
Copy link
Contributor

@MohamedAbdeen21 MohamedAbdeen21 commented Mar 6, 2025

Closes #1694

  • Minor refactoring of the parse_set parser (using match, extracting functions, etc ..)
  • Support multiple comma-separated assignments (SET a = 1, b = 2, ...) and a new variant to represent the syntax

@MohamedAbdeen21 MohamedAbdeen21 changed the title Update assignment list SET with a list of comma separated assignments Mar 6, 2025
Copy link
Contributor

@mvzink mvzink left a comment

Choose a reason for hiding this comment

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

Awesome, thank you. The only thing missing I can think of is the per-variable scope support represented by #1694, which should be a separate PR IMO. However, it will require changes to this new variant (and probably moving the modifier parsing around, not sure exactly how), so it would be good to keep in mind while reviewing this.

@MohamedAbdeen21
Copy link
Contributor Author

Ended up being a big one.

API changes:

  1. New struct SetAssignment instead of using the tuple (ObjectName, Expr) suggested above because visitor feature needs an enum or struct. Also renamed the original Assignment to UpdateAssignment.
  2. New enum Set includes all of Statement's Set* variants.

Other:
Update tests.
Slightly refactor parse_set parser.

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.

Thanks @MohamedAbdeen21! The changes look reasonable to me overall, left some comments

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 @MohamedAbdeen21!
Also thanks for the reviews @mvzink!
cc @alamb

@iffyio iffyio merged commit 85f8551 into apache:main Mar 12, 2025
9 checks passed
ayman-sigma pushed a commit to sigmacomputing/sqlparser-rs that referenced this pull request Apr 10, 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.

Parse MySQL SET GLOBAL variables
3 participants