fix(parser): model ALTER COLUMN nullability actions - #2529
Merged
manticore-projects merged 1 commit intoSep 3, 2026
Merged
Conversation
Represent SET NOT NULL with a dedicated AST node and match DROP NOT NULL before the generic column-data-type branch. Cover parsing, deparsing, validation, and reflection.
minleejae
force-pushed
the
fix/alter-column-nullability-ast
branch
from
September 3, 2026 06:26
6c66159 to
466f1bd
Compare
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
AlterExpression.ColumnSetNotNullAST model forALTER COLUMN ... SET NOT NULL.ColumnDropNotNullproduction before the generic column-data-type production.AlterExpression.toString().AlterValidator.Why
Both statements currently parse, but their ASTs are not reliable:
SET NOT NULLis represented as a column data type namedSETwith[NOT, NULL]in its raw column specs.DROP NOT NULLis also consumed by the generic column-data-type branch even though a dedicatedColumnDropNotNullmodel already exists. Consumers therefore have to inspect and reconstruct raw tokens instead of using the AST.This change gives both PostgreSQL nullability actions explicit AST representations without changing unrelated column option parsing.
PostgreSQL grammar reference: https://www.postgresql.org/docs/current/sql-altertable.html
Testing
./gradlew checkSET NOT NULL.ReflectionModelTest.AI assistance
OpenAI Codex was used to trace the grammar branch selection, prepare the AST/deparser/validator changes, and run validation. The generated change and tests were reviewed against the PostgreSQL documentation.