[
https://issues.apache.org/jira/browse/CALCITE-4080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17143122#comment-17143122
]
Julian Hyde commented on CALCITE-4080:
--------------------------------------
You are correct. MySQL allows character literals as column aliases (with or
without 'as'). I was not aware of this.
Supporting character literal aliases would be a new feature, for compatibility
with MySQL. It would be enabled by a parser option, and off by default.
MySQL does not allow character literals for table aliases.
> Exception occurs when parsing quoted aliases for select columns
> ---------------------------------------------------------------
>
> Key: CALCITE-4080
> URL: https://issues.apache.org/jira/browse/CALCITE-4080
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.23.0
> Reporter: Dan Cojocaru
> Priority: Major
>
> Exception occurs while parsing query with quoted alias for select columns.
> {code:java}
> final FrameworkConfig config = Frameworks.newConfigBuilder()
> .parserConfig(SqlParser.configBuilder().setLex(Lex.MYSQL)
> .setConformance(SqlConformanceEnum.MYSQL_5).build())
> .programs(Programs.ofRules(Programs.RULE_SET))
> .build();
> Planner p = Frameworks.getPlanner(config);
> SqlNode n = p.parse("SELECT 1 AS 'some alias' from dual");
> {code}
> The following exception is thrown:
> {code:java}
> org.apache.calcite.sql.parser.SqlParseException: Encountered "\'some alias\'"
> at line 1, column 13.
> Was expecting one of:
> <BRACKET_QUOTED_IDENTIFIER> ...
> <QUOTED_IDENTIFIER> ...
> <BACK_QUOTED_IDENTIFIER> ...
> <IDENTIFIER> ...
> <UNICODE_QUOTED_IDENTIFIER> ...{code}
> If query is changed into :
> {code:java}
> "SELECT 1 AS some_alias from dual"
> {code}
> the query is parsed correctly.
>
> Quoted aliases ( e.g: 'some alias' ) {color:#172b4d}should be valid as
> well.{color}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)