Skip to content

BI dialect spellings rejected: CHAR_LENGTH / CHARACTER_LENGTH, TIMESTAMPADD / TIMESTAMPDIFF, SELECT TOP n #361

Description

@fupelaqu

The Epic 19 BI capture recorded four statements rejected for a dialect spelling, not for a missing capability. Each was bisected to a single cause; the engine already implements the semantics under a different name.

capture id statement (excerpt) bisected cause
tableau.sql92.w8.032 SUM(CHAR_LENGTH("bi_events"."name")) CHAR_LENGTH/CHARACTER_LENGTH are not accepted spellings (LENGTH and LEN are); every other clause parses
tableau.sql92.wx.010 SELECT TOP 1 * FROM "elastic"."bi_events" the T-SQL TOP n clause is not in the grammar — the same statement with LIMIT 1 parses
tableau.sql92.w4.025 … >= {fn TIMESTAMPADD(SQL_TSI_DAY,-89,CURRENT_DATE)} two independent blockers: the ODBC {fn …} escape, and the TIMESTAMPADD spelling (rejected even unbraced with a bare DAY unit)

Why these are cheap

DATE_ADD/DATETIME_ADD already accept the ODBC/T-SQL (unit, count, base) argument order through their transactSql form, including a negative count and CURRENT_DATE as the base — measured on origin/main:

DATE_ADD(DAY, -89, CURRENT_DATE)       OK   round-trip=true
TIMESTAMPADD(DAY, -89, CURRENT_DATE)   REJECT

So TIMESTAMPADD is a missing name, not missing behaviour. Likewise CHAR_LENGTH: our LENGTH already counts characters, which is exactly what CHAR_LENGTH means (MySQL's own LENGTH counts bytes, so CHAR_LENGTH is the spelling that agrees with us).

Scope

  • CHAR_LENGTH / CHARACTER_LENGTH as spellings of LENGTH
  • TIMESTAMPADD as a spelling of DATETIME_ADD, TIMESTAMPDIFF as one of DATE_DIFF, plus the ODBC SQL_TSI_* interval names
  • SELECT TOP n folded into the statement's LIMIT

Out of scope, and it means tableau.sql92.w4.025 does not flip: the ODBC {fn … } escape. That is a pre-parse normalisation rather than a grammar production and belongs in its own change. TIMESTAMPSUB is also out of scope — it exists in neither ODBC nor MySQL 8.4; the capture uses a negative count with TIMESTAMPADD.

Every spelling must be an alias, not a second mechanism: the render normalises to the canonical form and that render must re-parse.

No activity

Activity on this issue will appear here.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions