-
-
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
ParenthesedSelect
s are allowed to appear within CTEsSolution
Change the
WithItem
class so that...WithItem
no longer extendsParenthesedSelect
WithItem
has type T where T extends the new interfaceParenthesedStatement
ParenthesedSelect
implementsParenthesedStatement
ParenthesedInsert
+ParenthesedUpdate
+ParenthesedDelete
are also implementationsParenthesedStatement
Notes
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
getWithItemsList
in various classes now returns aList<WithItem<?>>
object rather than aList<WithItem>
object. I think this should be the most "disruptive" thing I've included.