sql-parser icon indicating copy to clipboard operation
sql-parser copied to clipboard

Aliases not supported after CASE expression

Open nijel opened this issue 8 years ago • 3 comments

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

nijel avatar Jul 31 '17 13:07 nijel

Thank you for reporting. This has been fixed with #203 and will be part of the 4.3.0 release of sql-parser.

ibennetch avatar Dec 24 '18 17:12 ibennetch

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.

ibennetch avatar Dec 24 '18 17:12 ibennetch

@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.

ibennetch avatar Dec 24 '18 17:12 ibennetch