Skip to content

SQL-standard single-quote escaping ('') is unsupported anywhere — any literal containing an apostrophe is a parse error #274

Description

@fupelaqu

Found 2026-09-04 while specifying Epic 21 (Core SQL Front Door), by running the real app.softnetwork.elastic.sql.parser.Parser compiled from main (ac54a079).

Measured

REJECT  end of input expected  | SELECT 'O''Brien' FROM t
REJECT  end of input expected  | SELECT name FROM t WHERE name = 'O''Brien'

Doubling a single quote inside a string literal — '', the SQL-standard escape accepted by every engine — is not supported anywhere in the grammar.

Why it matters

This is not a BI-dialect nicety. Any literal containing an apostrophe is a parse error on every surface:

  • BI-generated SQL (a filter on a surname, a category label)
  • analyst-typed SQL in a SQL pane or the REPL
  • the JDBC / ADBC / Flight drivers
  • DML VALUES and DDL defaults

O'Brien, don't, l'avion — ordinary data. There is no workaround in the dialect today.

Related

  • Story 21.1 of Epic 21 adopts SQL-standard doubling for identifiers ("a""b"). Shipping doubling for identifiers while literals still reject it would leave the dialect incoherent — these should land together or in a stated order.
  • ⚠️ Three hand-written quote-aware scanners must agree on the new rule, or a doubled quote splits one statement into two malformed halves: Parser.normalize, Parser.scriptBody, and GatewayApi.splitStatements (the last lives in core, not sql).

Scope

sql/src/main/scala/app/softnetwork/elastic/sql/parser/ — the string-literal production and the three scanners above. Regression tests must cover the literal in SELECT / WHERE / function arguments / IN lists / VALUES / DDL defaults, plus a render round-trip fixed point (a literal containing a quote must re-parse to an equal AST).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions