Skip to content

Structure PostgreSQL column type and generated expression replacements - #2716

Merged
manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:feat/postgresql-column-replacements-20260925
Sep 27, 2026
Merged

manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:feat/postgresql-column-replacements-20260925

Conversation

@minleejae

Copy link
Copy Markdown
Contributor

PostgreSQL accepts ALTER TABLE t ALTER COLUMN id SET DATA TYPE bigint USING id::bigint, but the parser rejected SET DATA TYPE. ALTER COLUMN g SET EXPRESSION AS (...) could parse as a column type change, leaving the expression inaccessible through the appropriate AST node.

Share the TYPE/SET DATA TYPE prefix between ALTER TABLE and ALTER TYPE, and share generated-expression parsing/rendering with CREATE TABLE. Add a distinct SET_EXPRESSION action whose expression participates in visitors and deparsing, while retaining existing type-change accessors.

Tests cover both type prefixes, USING/COLLATE, composite attributes, optional COLUMN, expression mutation and custom deparsing, multiple actions, and invalid contexts. Relevant corpus cases were executed on PostgreSQL 18.6 using original SQL, toString output, and StatementDeParser output; resulting catalog definitions match.

Syntax references: ALTER TABLE, ALTER TYPE.

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.

…ements

Signed-off-by: minleejae <mmj9808@gmail.com>
@manticore-projects
manticore-projects merged commit 485e6f9 into JSQLParser:master Sep 27, 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