Conversation
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.
Column definitions currently retain many attributes as raw strings. For example,
ON UPDATE CURRENT_TIMESTAMP(6)is split into tokens and a generated column's expression cannot be visited or rewritten. Extend the existingColumnOptionmodel to preserve these attributes in CREATE and ALTER column definitions.This adds structured nullability, collation, comment literals, ON UPDATE expressions, AUTO_INCREMENT, visibility and inline PRIMARY KEY.
GeneratedColumnDefinitionpreserves the expression, optional GENERATED ALWAYS prefix and explicit STORED/VIRTUAL choice; existing identity declarations keep their own model. Shared table-definition traversal and rendering now expose the new expressions to visitors, validators and custom deparsers.Charset remains on
ColDataType, while column COLLATE is aColumnOption; consumers can read both directly. Unknown extensions retain their raw fallback and source order. The legacygetColumnSpecs()supplies a snapshot for structured options, with canonical keyword capitalization and expression fragments rendered as one token.setColumnSpecs()still explicitly replaces structured options;addColumnSpecs()preserves them. Existing tests that asserted the old raw-only representation were updated, with raw-setter coverage retained.Validation
Merged locally with fix: preserve PostgreSQL quoted names, numeric scales and comment literals #2638, feat: support additional PostgreSQL COMMENT targets #2639 and feat: preserve DROP INDEX owner tables in the AST #2640 without conflicts: 7,126 Gradle tests, zero failures/errors, 25 skipped; the grammar ambiguity check passed. All 193 new audit cases produced identical parser/rendering results in the combined build.
Full Gradle
check, including the JavaCC ambiguity gate, formatting, Checkstyle, PMD and SpotBugs: 6,946 tests, zero failures/errors, 25 skipped. Spotless ratchet pinned to base6312f9e5.EXPORT_TEST_TO_FILE=False mvn -B clean verify: 6,928 tests, zero failures/errors, 25 skipped.Database differential audit: 132 valid MySQL 8.4.11 cases and 20 valid PostgreSQL 18.6 cases produced identical column metadata from original and regenerated SQL; five malformed definitions were rejected. Checks cover CREATE/ADD/MODIFY/CHANGE, charset/collation, stored comments, ON UPDATE and generated-column expressions/storage.
Regression tests check AST payloads after both rendering paths, expression visitors, validation, mutations, identity/reference/default boundaries and legacy token behavior.
No server defaults or expression-validity rules are inferred. SQL Server's unparenthesized computed-column forms, complete column-constraint modeling and semantic literal decoding remain outside this change. This enriches the existing AST independently of the querying API discussed in #2620.
Syntax references: MySQL column definitions, MySQL generated columns, MySQL automatic timestamp updating, PostgreSQL column definitions.