Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CASE with alias is not properly parsed #588

Open
EljaRory opened this issue Oct 2, 2024 · 1 comment
Open

CASE with alias is not properly parsed #588

EljaRory opened this issue Oct 2, 2024 · 1 comment
Labels

Comments

@EljaRory
Copy link

EljaRory commented Oct 2, 2024

Feeding this SQL to the Parser:

SELECT
  CASE 
    WHEN a.kol = 1 THEN 'one'
    ELSE a.kol
  END as 'case'
FROM foo a;

will result in errors, and calling build() on the statement will result in this SQL:

SELECT CASE 'case' ELSE a.kol AS `END` END FROM foo AS `a`

The errors array contains these errors:

  • An alias was previously found.
  • An alias was expected.
  • Unexpected keyword.
  • Unexpected end of CASE expression

I encountered this problem since I upgraded from 5.8.2 to 5.9.1.

@williamdes williamdes added the bug label Dec 21, 2024
@williamdes
Copy link
Member

williamdes commented Dec 21, 2024

Thank you for reporting this bug

Still confirmed today on 5.2.2-dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants