Repository navigation
Treat whitespace-only primary_key values as unset - #832
Merged
Merged
Conversation
There was a problem hiding this comment.
Auto-approved by the AI review gate on c643f9d. Details in the approver's comment on this pull request.
AI review gate — auto-approved
History (latest 5 heads, newest first)
|
canbekley
approved these changes
Nov 26, 2026
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.
Extraction from #717
Before this,
primary_key=' 'orprimary_key=['id', ' ']rendered an invalidPRIMARY KEYclause and ClickHouse rejected theCREATE TABLEwith a syntax error. Now:primary_key_clausenow trims theprimary_keyconfig before using it.''and[]already were.The same trimming is already in the v2 copy of the macro, so this keeps the two macro trees aligned.
Note
Low Risk
Narrow DDL macro change with integration tests; trims invalid primary_key configs instead of changing valid ones.
Overview
primary_key_clausenow trims string values and drops whitespace-only list entries before building ClickHouse DDL, so configs likeprimary_key=' 'orprimary_key=['id', ' ']no longer emit a barePRIMARY KEYthat failsCREATE TABLE. When nothing valid remains after trimming, the clause is omitted and ClickHouse keeps the sorting key as before—same behavior as empty string or[].Integration coverage adds three table models (whitespace string, mixed list with blank entries, whitespace-only list) and extends
test_primary_key_variantsto assert the effective primary key viasystem.tables. CHANGELOG records the bugfix under Unreleased.Reviewed by Cursor Bugbot for commit c643f9d. Bugbot is set up for automated code reviews on this repo. Configure here.