Skip to content

Conversation

tomershay
Copy link
Contributor

@tomershay tomershay commented Nov 26, 2017

MySQL supports single quotes around aliases (in addition to double quotes and backticks). They are only allowed in aliases in the SELECT clause. In other cases, only backticks are supported.

From the documentation:
"The identifier quote character is the backtick (`).
"In the select list of a query, a quoted column alias can be specified using identifier or string quoting characters".

https://dev.mysql.com/doc/refman/5.7/en/identifiers.html
The example in the documentation shows an alias with single quotes around it as valid - search for 'two' in the url above.

The following query is valid in MySQL, but JSqlParser currently fails when parsing it:
SELECT mycolumn AS 'My Column Name' FROM mytable

MySQL supports single quotes around aliases (in addition to double quotes and backticks). They are only allowed in aliases in the SELECT clause. In other cases, only backticks are supported.
https://dev.mysql.com/doc/refman/5.7/en/identifiers.html
From the documentation:
"The identifier quote character is the backtick (`)".
"In the select list of a query, a quoted column alias can be specified using identifier or string quoting characters".
@coveralls
Copy link

coveralls commented Nov 26, 2017

Coverage Status

Coverage increased (+0.003%) to 87.044% when pulling ddeb828 on sh-tomer:allow_single_quotes_around_aliases into f0ffe4c on JSQLParser:master.

@wumpz
Copy link
Member

wumpz commented Feb 14, 2018

fixed in #583

@wumpz wumpz closed this Feb 14, 2018
@tomershay tomershay deleted the allow_single_quotes_around_aliases branch December 20, 2018 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants