Repository navigation
fix: parse doubled single quote in quoted type strings - #608
Open
pcbeingused333 wants to merge 1 commit into
Open
pcbeingused333 wants to merge 1 commit into
pcbeingused333 wants to merge 1 commit into
Conversation
Enum8('it''s' = 1) was cut at the first quote of the pair, so the enum
label was truncated. Treat '' as an escaped single quote, as the
double-quote and backtick branches already do for their own quote.
AI review gate — AI review gate could not decide
What to do:
Re-run the gate with “Re-run jobs” after an approval or a finished review. A push re-runs it automatically. |
Contributor
|
Note: server never returns |
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.
Fixes #605
Cause. In
TypeParser::NextToken, the single-quote branch closes the string at the first'it sees, without checking whether the next character is another'.CreateColumnByType("Enum8('it''s' = 1)")therefore split'it''s'into two tokens, and the second one overwrote the label: the type was accepted with no error asEnum8('s' = 1), soAppend("it's")later threwunknown enum name. The"and`branch directly below already handles the doubled-quote form.Fix. Treat
''inside a single-quoted string as an escaped single quote. Other escapes are untouched.Test.
TypeParserCase.ParseEnum_DoubledSingleQuotecovers'it''s'and'''a'''; it fails on main and passes with the change (43/43TypeParser*tests).This change was prepared with the assistance of an AI coding tool (Claude) and submitted by the account owner.
Note
Low Risk
Localized lexer fix in type parsing with targeted unit tests; no auth, data, or API surface changes beyond correct string decoding.
Overview
Fixes incorrect tokenization of single-quoted literals in ClickHouse type strings when a label contains an apostrophe written as
''(ClickHouse-style escape).TypeParser::NextTokenpreviously ended the quoted string on the first', so types likeEnum8('it''s' = 1)were parsed with the wrong enum name (e.g.'s'), breaking inserts that use the real label. The parser now treats consecutive''inside single-quoted strings as one escaped', matching the existing behavior for"and backtick-quoted identifiers.A unit test covers enum parsing for
'it''s'and the edge case'''a'''→'a'.Reviewed by Cursor Bugbot for commit 1126c72. Bugbot is set up for automated code reviews on this repo. Configure here.