-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feature/fix: parsing inserts/updates/delete within CTEs #2055
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
feature/fix: parsing inserts/updates/delete within CTEs #2055
Conversation
|
Impressive contribution, thank you already for your time and effort! |
|
Clean, I really do like your work! Thank you again.
|
|
Please fix the formatting, then I can merge promptly. |
|
Thank you again! |
|
@manticore-projects I think Ive made the changes you've asked for...
However, Im still getting a Gradle test failure... It's strange because when I run |
No worries, I check/fix this from here. |
|
@manticore-projects Thanks a lot for your help 🙇 |

Problem
In Postgres it is valid syntax to have insert, update or delete statements appear within CTEs.
See here on https://www.postgresql.org/docs/current/sql-select.html
e.g.
The current version of the parser fails when faced with these statements as only
ParenthesedSelects are allowed to appear within CTEsSolution
Change the
WithItemclass so that...WithItemno longer extendsParenthesedSelectWithItemhas type T where T extends the new interfaceParenthesedStatementParenthesedSelectimplementsParenthesedStatementParenthesedInsert+ParenthesedUpdate+ParenthesedDeleteare also implementationsParenthesedStatementNotes
I could definitely do with some feedback on the approach Ive taken here.
I've done my best to avoid impacting any existing functionality. The method
getWithItemsListin various classes now returns aList<WithItem<?>>object rather than aList<WithItem>object. I think this should be the most "disruptive" thing I've included.