Skip to content

Share PostgreSQL relation targets and complete TRUNCATE options - #2719

Open
minleejae wants to merge 1 commit into
JSQLParser:masterfrom
minleejae:feat/postgresql-truncate-targets-20260925
Open

minleejae wants to merge 1 commit into
JSQLParser:masterfrom
minleejae:feat/postgresql-truncate-targets-20260925

Conversation

@minleejae

Copy link
Copy Markdown
Contributor

Valid PostgreSQL TRUNCATE forms such as TRUNCATE ONLY (t), child * RESTART IDENTITY RESTRICT were not supported. The existing visitors also processed only one table in a multiple-table TRUNCATE.

Share relation targets with LOCK TABLE, representing per-target ONLY, parenthesized ONLY, and descendant * scope. Add structured RESTART/CONTINUE IDENTITY and CASCADE/RESTRICT options, use one rendering path, and visit/validate every target. Preserve the legacy getTable accessor's last-target behavior and provide a mutable getTables projection onto the same target objects.

Tests cover target/option combinations, legacy and structured mutations, all-table traversal, shared LOCK targets, malformed clauses, and statement boundaries. Executed the relevant corpus and nine additional inheritance/identity combinations on PostgreSQL 18.6; original and rendered SQL produce matching table, row-count and sequence state.

Syntax references: TRUNCATE, LOCK.

Validation: focused tests, JavaCC ambiguity checks, Checkstyle and Spotless on this independent branch. The combined implementation also passes the full Gradle check and Maven verify; the 1,304-input prior regression corpus has no previously successful input regressions.

This branch has not been deployed

No deployments
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