Skip to content

fix: treat optional identifier quoting as equivalent in table diffs - #254

Open
cliff-openai wants to merge 1 commit into
cloudspannerecosystem:mainfrom
cliff-openai:cliff/fix-quoted-identifier-diff
Open

fix: treat optional identifier quoting as equivalent in table diffs#254
cliff-openai wants to merge 1 commit into
cloudspannerecosystem:mainfrom
cliff-openai:cliff/fix-quoted-identifier-diff

Conversation

@cliff-openai

@cliff-openai cliff-openai commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Cloud Spanner's live DDL may omit optional backticks present in a source schema. The first schema update can succeed, but subsequent plans then fail with “Cannot change primary key” because the diff compares rendered key text. Quoted and unquoted column names can likewise appear to be different columns.

Compare primary-key parts and column definitions by their identifier values rather than optional quoting, while retaining the source spelling in generated DDL. Key order and direction remain significant, and genuine column changes still produce migrations.

Spanner may return unquoted identifiers in live DDL even when the source schema quotes them. Comparing the rendered primary key then rejects a no-op migration as an unsupported key change; comparing column names literally can also manufacture drops and additions.

Compare the identifier represented by each key and column independently of optional backticks while preserving the original spelling when rendering DDL. Keep key order and direction checks intact, and cover the no-op and genuine column-change cases.
@cliff-openai
cliff-openai force-pushed the cliff/fix-quoted-identifier-diff branch from ca6aee8 to fc1eb72 Compare September 4, 2026 16:44
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.

1 participant