fix(internal): apply QuotedIdentifier in more cases#274
Merged
tianzhou merged 1 commit intopgplex:mainfrom Jan 31, 2026
Merged
Conversation
Add test cases to test for these, fixes pgplex#270
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes incorrect SQL generation when table columns use quoted identifiers (e.g., "ID"), ensuring generated ALTER/COLUMN COMMENT statements quote identifiers consistently (addresses #270).
Changes:
- Quote column identifiers in ALTER COLUMN statements (type/default/nullability changes).
- Quote column identifiers in COMMENT ON COLUMN statements (both create-time and alter-time).
- Add golden diff test cases for ALTER COLUMN + column comments with quoted identifiers.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| internal/diff/column.go | Applies ir.QuoteIdentifier to column names in generated ALTER TABLE ... ALTER COLUMN ... statements (including USING expressions). |
| internal/diff/table.go | Applies ir.QuoteIdentifier to column names in generated COMMENT ON COLUMN ... statements (create + alter paths). |
| testdata/diff/create_table/alter_column_quoted_identifier/old.sql | Adds baseline schema for quoted-column type-change test. |
| testdata/diff/create_table/alter_column_quoted_identifier/new.sql | Adds target schema for quoted-column type-change test. |
| testdata/diff/create_table/alter_column_quoted_identifier/diff.sql | Golden expected diff SQL for quoted-column type-change. |
| testdata/diff/create_table/alter_column_quoted_identifier/plan.sql | Golden expected plan SQL output for quoted-column type-change. |
| testdata/diff/create_table/alter_column_quoted_identifier/plan.txt | Golden expected human-readable plan output for quoted-column type-change. |
| testdata/diff/create_table/alter_column_quoted_identifier/plan.json | Golden expected JSON plan output for quoted-column type-change. |
| testdata/diff/comment/column_comment_quoted_identifier/old.sql | Adds baseline schema for quoted-column comment test. |
| testdata/diff/comment/column_comment_quoted_identifier/new.sql | Adds target schema for quoted-column comment test. |
| testdata/diff/comment/column_comment_quoted_identifier/diff.sql | Golden expected diff SQL for quoted-column comment. |
| testdata/diff/comment/column_comment_quoted_identifier/plan.sql | Golden expected plan SQL output for quoted-column comment. |
| testdata/diff/comment/column_comment_quoted_identifier/plan.txt | Golden expected human-readable plan output for quoted-column comment. |
| testdata/diff/comment/column_comment_quoted_identifier/plan.json | Golden expected JSON plan output for quoted-column comment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tianzhou
approved these changes
Jan 31, 2026
Contributor
tianzhou
left a comment
There was a problem hiding this comment.
LGTM. Thank for the contributions
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.
Add test cases to test for these, fixes #270
Example of this fixing the issue: