[CALCITE-7550] SqlUpdate and SqlDelete unparse EXISTS subqueries without parentheses#4969
[CALCITE-7550] SqlUpdate and SqlDelete unparse EXISTS subqueries without parentheses#4969zzwqqq wants to merge 1 commit into
Conversation
|
|
Is the same problem valid for MERGE ? I think it is possible to specify EXISTS inside ON clause |
|
@zzwqqq I hope you can answer @dssysolyatin's question before we merge this |
Thanks for pointing this out. I have not checked the MERGE case in detail yet, but based on your comment there may be a similar issue. I opened CALCITE-7585 to track this separately, since it seems related but outside the current UPDATE/DELETE fix. I will follow up there with a concrete reproduction and more details once I confirm the behavior. If the issue is valid, I will continue working on it there. |
Thanks. I opened CALCITE-7585 to track this separately. I will try to reproduce the MERGE case there and add more details once the behavior is confirmed. |



Jira Link
CALCITE-7550
Changes Proposed
Fixes unparsing of
EXISTSsubqueries inUPDATEandDELETEstatements.SqlUpdateandSqlDeletewere unparsing theWHEREcondition directly, which could produce invalid SQL such asWHERE EXISTS SELECT ....This change moves the existing
WHEREunparsing logic fromSqlSelectOperatorintoSqlUtil.unparseWhereClauseand reuses it forSELECT,UPDATE, andDELETE, so DML statements use the sameWHERE_LISTframe behavior as queries.Adds regression tests for
UPDATEandDELETEwithEXISTSpredicates.