Skip to content

Support PostgreSQL conflict index elements, OVERRIDING USER and MERGE RETURNING - #2569

Open
minleejae wants to merge 2 commits into
JSQLParser:masterfrom
minleejae:feat/postgresql-dml-targets
Open

Support PostgreSQL conflict index elements, OVERRIDING USER and MERGE RETURNING#2569
minleejae wants to merge 2 commits into
JSQLParser:masterfrom
minleejae:feat/postgresql-dml-targets

Conversation

@minleejae

@minleejae minleejae commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

PostgreSQL INSERT currently rejects conflict targets mixing columns and expressions, accepts only OVERRIDING SYSTEM VALUE, and MERGE has no RETURNING clause. This adds ordered conflict keys with COLLATE and schema-qualified operator classes, distinguishes USER/SYSTEM overriding, and connects MERGE to the existing ReturningClause (including OLD/NEW output aliases). Bare function keys and OVERRIDING without a column list are supported.

The target reuses Index.ColumnParams and centralizes expression traversal and rendering. Existing conflict-column getters remain mutable views, existing replacement methods remain available, and the boolean overriding API still maps true to SYSTEM. MERGE RETURNING uses visitor-based output; ExpressionDeParser now preserves normalized OLD/NEW qualifiers. Statement visitors, table discovery and validators visit the newly supported expressions.

Validation:

  • Full Gradle check and Maven verify.
  • Parsing, AST assertions, reparsing, deparser output, custom visitors and legacy mutation tests.
  • Representative INSERT/MERGE statements executed on PostgreSQL 18.

References: PostgreSQL INSERT, PostgreSQL MERGE.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant