LucaCappelletti94 opened a new pull request, #2669: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2669
Follow-up to #2668, which this PR is stacked on. Engines differ on single-quoted string aliases. SQLite 3.51.1 accepts `SELECT 1 AS 'x'`, `SELECT 1 'x'`, `FROM t AS 'y'` and `FROM t 'y'`. DuckDB 1.4.4 accepts only the two forms with `AS`. MySQL accepts a string as a column alias but not as a table alias (`select_alias` against `opt_table_alias` in https://github.com/mysql/mysql-server/blob/trunk/sql/sql_yacc.yy). Spark (`namedExpression` and `tableAlias` in https://github.com/apache/spark/blob/master/sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4), Hive (`selectItem` and `tableAlias`) and ClickHouse (`ParserAlias` only takes identifiers, https://clickhouse.com/docs/reference/syntax#identifiers) accept none of them. Every one of these dialects accepted all four forms. `supports_string_literal_alias` is replaced by `supports_string_literal_column_alias` and `supports_string_literal_table_alias`, each told whether the alias follows `AS`. Both default to `true`, so dialects whose engines were not checked are unchanged. A per-engine test pins all four forms for PostgreSQL, SQLite, DuckDB, MySQL, Spark, Databricks, Hive and ClickHouse, and a capability-driven test checks every dialect against the exact errors. I used Opus in support of this PR to try and include all relevant dialects, I checked the various documentations it found and they seem correct to me. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
