Replies: 3 comments
|
Thank you. Item 1) is interesting for BigQuery especially and I have had to apply ugly workarounds in JSQLTranspiler I am not a big fan of item 3, but as always: if we can get it done somehow, I won't oppose it. |
|
Please let us always consider DataBricks, BigQuery, Snowflake and Redshift as well. |
|
The four warehouses split evenly on
With MySQL default mode on the string side and ANSI/Postgres/Oracle/SQL Server on the identifier side, item 1 has preset rows on both ends of the switch, so it is next for me. Also from the BigQuery lexical page: Item 2 is yours then, noted as a feature rather than a conflict. Item 3 gained shape while checking the warehouses: the standard and Postgres concatenate adjacent literals only across a newline, GoogleSQL and Spark/Databricks across any whitespace (their literal chunking), MySQL and SQL Server alias, Oracle errors. Three readings, so not a boolean switch: an enum-valued feature (off / newline-only / any whitespace), the shape Sources: BigQuery lexical, Spark literals, Snowflake identifiers, Redshift names, PostgreSQL lexical |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
AI disclosure: this discussion was prepared with AI coding agents, reviewed and revised line by line by me.
The one-lexeme-two-dialects class of problem keeps recurring (#677, #2466, #2502), and each resolution left a switch behind:
allowSquareBracketQuotation(v3.0),allowBackslashEscapeCharacter(v4.6),allowHashLineComments(#2508), now reachable per dialect through the #2511 presets, a narrow slice of the dialect-aware direction @minleejae argued for in #2465. Following up on its "more deterministic parsing in ambiguous cases" benefit, here is an inventory of the remaining contested lexemes, every row probed on master94c4508first hand.Already covered
[..]\#?js ? 'k'and `js ?||SELECT a || byields Concat on masterMINUS/EXCEPT`q'[..]',E'..',B'..',X'..',@var,@@varOpen conflicts
"...": identifier vs string literal. ANSI, Postgres, Oracle and SQL Server (QUOTED_IDENTIFIER ON) read double quotes as identifiers; MySQL default mode and SQL Server with QUOTED_IDENTIFIER OFF read them as string literals. Master always produces the identifier reading:SELECT "not an identifier"yields a Column. A MySQL user silently gets the wrong AST node type. No switch exists today (checkedFeatureand its history). Candidate: anallowDoubleQuotedStrings-style switch, off by default, with the MySQL preset turning it on (MySQL itself flips back to identifiers under ANSI_QUOTES, so the preset row would take a decision).$tag$...$tag$: tagged dollar quoting, [BUG] JSQLParser 5.1: PostgreSQL: fail to parse dollar-quoted string constants with tags #2233. Plain$$abc$$parses (StringValue), a tag breaks the lexer:SELECT $tag$ it's $tag$fails with a TokenMgrException. Same machinery family as the feat(parser): support MySQL # line comments behind allowHashLineComments #2508 flag work, a MORE-style state keyed on the opening tag, and it unlocks function bodies for the Postgres family.'a' 'b': adjacent string literals. The standard and Postgres concatenate adjacent literals only when the whitespace between them contains a newline (PostgreSQL docs); GoogleSQL and Spark/Databricks concatenate them across any whitespace (their literal chunking); MySQL and SQL Server read the second one as an alias; Oracle errors. Master takes the alias reading silently:SELECT 'a' 'b'yields the StringValue'a'aliased'b', expression contexts fail loudly. Lower impact, but the same never-silently-wrong-dialect class. (Corrected: the original row missed the newline qualifier and the GoogleSQL/Spark variant.)Proposal
Continue the incremental pattern that just carried
#through: one conflict, one switch off by default, one preset row, two-state tests, every behavior delta disclosed. The double-quote item looks like the highest-value next step; I am happy to prepare it, and the tagged dollar quoting after that (with due diligence to the 19 comments of prior art on #2233).All reactions