Skip to content

feat: support PostgreSQL ALTER SCHEMA actions - #2670

Merged
manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:feat/postgresql-alter-schema
Sep 21, 2026
Merged

manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:feat/postgresql-alter-schema

Conversation

@minleejae

Copy link
Copy Markdown
Contributor

PostgreSQL schema rename and ownership changes are missing from the statement grammar. Migration tools therefore cannot parse ALTER SCHEMA analytics RENAME TO reporting or inspect an ownership change as a structured statement.

Add AlterSchema with RENAME and OWNER actions, preserving identifier quoting and CURRENT_USER/CURRENT_ROLE/SESSION_USER owner forms. Reuse the existing identifier and contextual-keyword productions, share rendering with StatementDeParser, and connect the statement to visitors, TablesNamesFinder and the PostgreSQL/ALTER validation feature sets.

Tests cover both actions, quoted names, AST mutation, visitor dispatch, statement boundaries, feature validation and incomplete or invalid qualified names. Database authorization and object existence remain database checks.

Syntax reference: PostgreSQL ALTER SCHEMA.

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: 12 cases (7 valid, 5 invalid). For all 7 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>
@manticore-projects
manticore-projects merged commit d4295ce 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