Closed 121onto closed 7 years ago
Thanks for reporting this, it seems the syntactic analysis code is confused about the list in the second when clause. I will push a fix in a few days, but as a workaround, you can use brackets around the CASE statement, like so:
select pk_id
, (case
when t1.c1 is null then '(null)'
when t1.c1 in ('a', 'b','c','d','e') then 'a'
else t1.c1
end) c1_alt
from t1
limit 10
;
You might also want to setup your own indentation rules since by default the code indents case statements at the same level as the "case" keyword itself. Have a look at sql-indent.org
file for more details and the sql-indent-left.el
file for an example.
BTW, the "limit" keyword is also not recognized, I will fix that as well.
I just pushed a fix for this issue. Can you please verify that it is indeed fixed? Thanks, Alex.
Thanks, Alex! I didn't update, just started using parens...
Example
Expected behavior:
Actual behavior:
Ideal behavior: