Skip to content

Conversation

@waterdrag0n
Copy link
Contributor

Problem

The lexer doesn't handle escape sequences in string literals, causing parser failures when using features like additional_table_filters with quoted values.

Example that fails:

SELECT * FROM logs
SETTINGS additional_table_filters={'logs': 'level = \'ERROR\''};

Error: expected the last token kind is: }, but got <ident>

Solution

Updated consumeString() in the lexer to handle both ClickHouse-standard escape methods:

  • Backslash escapes: '
  • Double single quotes: ''

@coveralls
Copy link

Pull Request Test Coverage Report for Build 19030368812

Details

  • 16 of 16 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.06%) to 50.619%

Totals Coverage Status
Change from base Build 18928213117: 0.06%
Covered Lines: 7641
Relevant Lines: 15095

💛 - Coveralls

Copy link
Member

@git-hulk git-hulk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@waterdrag0n Thanks for your good catch and fix.

@git-hulk git-hulk merged commit 4057101 into AfterShip:master Nov 3, 2025
2 checks passed
@waterdrag0n waterdrag0n deleted the lexer-string-escapes branch November 3, 2025 09:56
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.

3 participants