Skip to content

feat: model PostgreSQL LOCK targets and lock modes - #2668

Merged
manticore-projects merged 2 commits into
JSQLParser:masterfrom
minleejae:feat/postgresql-lock-targets
Sep 21, 2026
Merged

manticore-projects merged 2 commits into
JSQLParser:masterfrom
minleejae:feat/postgresql-lock-targets

Conversation

@minleejae

Copy link
Copy Markdown
Contributor

PostgreSQL LOCK supports multiple targets, inheritance scopes, omitted TABLE/IN MODE clauses and three modes missing from the existing single-table model. This prevents parsing common statements such as LOCK ONLY a, b * NOWAIT.

Introduce structured lock targets with DEFAULT, ONLY and INCLUDING_DESCENDANTS scopes, and support all eight PostgreSQL lock modes. Factor target and mode parsing into separate productions and share statement rendering with StatementDeParser. TablesNamesFinder now visits every target. The existing table getters/setters remain a view of the first target, and existing Oracle SHARE UPDATE and WAIT forms retain regression coverage.

Tests cover all modes, multiple targets, optional clauses, quoted and qualified names, AST mutation, legacy constructors/accessors and conflicting or incomplete syntax. Oracle compatibility is covered by parser tests; Oracle server execution was not performed.

Syntax reference: PostgreSQL LOCK.

Validation:

  • Full Gradle check passed on Java 17, including grammar ambiguity, formatting, static analysis, coverage and the full test suite. JUnit XML totals: 7999 tests, 0 failures/errors, 25 skipped.
  • PostgreSQL 17.11: 19 cases (13 valid, 6 invalid). For all 13 valid cases, the original SQL, toString() output and StatementDeParser output executed successfully with matching query results or resulting schema state. Invalid inputs were rejected by the server.

Signed-off-by: minleejae <mmj9808@gmail.com>
Signed-off-by: minleejae <mmj9808@gmail.com>
@manticore-projects
manticore-projects merged commit f64ddd5 into JSQLParser:master Sep 21, 2026
10 checks passed
@manticore-projects

Copy link
Copy Markdown
Contributor

Thank you!

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.

2 participants