feature/fix: parsing inserts/updates/delete within CTEs#2055
feature/fix: parsing inserts/updates/delete within CTEs#2055manticore-projects merged 5 commits intoJSQLParser:masterfrom
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.