Skip to content

feat: share PostgreSQL table, index and view alteration actions - #2707

Merged
manticore-projects merged 6 commits into
JSQLParser:masterfrom
minleejae:feat/postgresql-relation-alter-actions
Sep 25, 2026
Merged

manticore-projects merged 6 commits into
JSQLParser:masterfrom
minleejae:feat/postgresql-relation-alter-actions

Conversation

@minleejae

@minleejae minleejae commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

PostgreSQL table, index and view property changes previously fell back to raw ALTER text or failed to parse, preventing callers from inspecting and modifying their targets and values. This introduces a shared RelationAlterAction model and parser for ALTER TABLE, ALTER INDEX, ALTER VIEW properties and ALTER MATERIALIZED VIEW, while retaining the existing ALTER VIEW AS path.

The shared actions cover rename/owner/schema, storage parameters, tablespace/access method, column defaults/statistics/storage/compression, dependency and constraint/inheritance changes, replica identity, clustering, persistence, typed-table association and trigger states. Column statistics retain explicit DEFAULT and expose SET/RESET attribute options. A separate AlterTablespaceMove models ALL IN TABLESPACE with owner filters and NOWAIT across tables, indexes and materialized views, so tablespaces and index/type names are not reported as table references.

Object-specific validation rejects unsupported combinations. Rendering, expression traversal and table discovery reuse the same action models; the existing table and query-definition APIs remain available.

Validation: full Gradle check, including JavaCC ambiguity, unit tests and static analysis. Added AST mutation, visitor, statement-boundary, invalid-form and round-trip coverage. PostgreSQL 18.6 execution compared original/toString/deparser catalog results for 31 additional property, column-statistics and bulk-move cases; all matched. ALTER INDEX column SET STATISTICS DEFAULT was additionally confirmed on the actual PostgreSQL 18.6 server.

Syntax references: ALTER TABLE, ALTER INDEX, ALTER VIEW, ALTER MATERIALIZED VIEW.

Signed-off-by: minleejae <mmj9808@gmail.com>
Signed-off-by: minleejae <mmj9808@gmail.com>

# Conflicts:
#	src/main/java/net/sf/jsqlparser/statement/StatementVisitor.java
#	src/main/java/net/sf/jsqlparser/util/TablesNamesFinder.java
#	src/main/java/net/sf/jsqlparser/util/deparser/StatementDeParser.java
#	src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt
Signed-off-by: minleejae <mmj9808@gmail.com>
Signed-off-by: minleejae <mmj9808@gmail.com>
Signed-off-by: minleejae <mmj9808@gmail.com>
@manticore-projects
manticore-projects merged commit 386daa5 into JSQLParser:master Sep 25, 2026
9 of 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