sql-parser
sql-parser copied to clipboard
Aliases not supported after CASE expression
Aliases do not work after CASE expression:
$ ./bin/lint-query --query 'select 1 name'
#1: Unrecognized keyword. (near "name" at position 9)
$ ./bin/lint-query --query 'select case when 1 > 0 then "x" else "y" end AS name'
#1: Unrecognized keyword. (near "AS" at position 46)
#2: Unrecognized keyword. (near "name" at position 49)
See also #161 and https://github.com/phpmyadmin/phpmyadmin/issues/13541
Thank you for reporting. This has been fixed with #203 and will be part of the 4.3.0 release of sql-parser.
I'm going to leave this opened because while the second query works, the first one (./bin/lint-query --query 'select 1 name') still gives an error.
@mostertb Perhaps you have some thought about the first query as well, since you did a great job on the other parts. Not a huge deal if you don't have time or interest, but since you were just working with that part of the code it may still be fresh in your mind.