Skip to content

[CALCITE-7550] SqlUpdate and SqlDelete unparse EXISTS subqueries without parentheses#4969

Open
zzwqqq wants to merge 1 commit into
apache:mainfrom
zzwqqq:fix_unparse_where_sqlupdate_sqldelete
Open

[CALCITE-7550] SqlUpdate and SqlDelete unparse EXISTS subqueries without parentheses#4969
zzwqqq wants to merge 1 commit into
apache:mainfrom
zzwqqq:fix_unparse_where_sqlupdate_sqldelete

Conversation

@zzwqqq
Copy link
Copy Markdown
Contributor

@zzwqqq zzwqqq commented May 26, 2026

Jira Link

CALCITE-7550

Changes Proposed

Fixes unparsing of EXISTS subqueries in UPDATE and DELETE statements.

SqlUpdate and SqlDelete were unparsing the WHERE condition directly, which could produce invalid SQL such as WHERE EXISTS SELECT ....

This change moves the existing WHERE unparsing logic from SqlSelectOperator into SqlUtil.unparseWhereClause and reuses it for SELECT, UPDATE, and DELETE, so DML statements use the same WHERE_LIST frame behavior as queries.

Adds regression tests for UPDATE and DELETE with EXISTS predicates.

@sonarqubecloud
Copy link
Copy Markdown

@mihaibudiu mihaibudiu added the LGTM-will-merge-soon Overall PR looks OK. Only minor things left. label May 26, 2026
@dssysolyatin
Copy link
Copy Markdown
Contributor

Is the same problem valid for MERGE ? I think it is possible to specify EXISTS inside ON clause

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LGTM-will-merge-soon Overall PR looks OK. Only minor things left.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants