• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

AfterShip / clickhouse-sql-parser / 27320667213

11 Jun 2026 02:54AM UTC coverage: 52.169% (+0.2%) from 52.012%
27320667213

Pull #275

github

git-hulk
Split keywords into reserved and non-reserved sets

matchTokenKind previously coerced every keyword token to match
TokenKindIdent, so any keyword could silently fill an identifier slot.
A missing name before a clause keyword then swallowed the keyword
instead of erroring: `SELECT a FROM WHERE b = 1` parsed FROM as a bare
alias of `a`, `INSERT INTO SELECT 1` ate SELECT as a table name. This
over-acceptance is the root of the recurring keyword-as-identifier bug
class (#268, #269, #270).

Introduce reservedKeywords - statement starters, clause starters and
expression operators - and narrow the coercion in matchTokenKind to
non-reserved keywords only. Positions where context proves even a
reserved keyword is a name use the new parseIdentAnyKeyword:

- after AS (select-item and table aliases)
- after a dot in qualified names (`db.from`, `t.from`)
- lookahead-disambiguated select items from #269
- query parameters (`{end:UInt32}`)
- window names (`OVER (order)`, `WINDOW order AS (...)`)
- GRANT options (`WITH GRANT OPTION`)
- gated function names (select-item modifiers, INSERT INTO FUNCTION)

Non-reserved keywords (DATE, KEY, FIRST, IF, LEFT, ANY, ...) keep
working as identifiers everywhere, including keywords that double as
ClickHouse function or engine names.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Pull Request #275: Split keywords into reserved and non-reserved sets

52 of 58 new or added lines in 5 files covered. (89.66%)

398 existing lines in 2 files now uncovered.

8407 of 16115 relevant lines covered (52.17%)

2735.94 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

69.21
/parser/parser_table.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc