-
Notifications
You must be signed in to change notification settings - Fork 804
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 WHEN does not work in SELECT field #2261
Comments
Seeing the same issue with PostgreSQL engine Notably, it doesn't fail when the above query is modified to: SELECT
CASE WHEN
EXISTS (
SELECT * FROM users WHERE id = '123'
)
THEN (SELECT 1)
ELSE (SELECT 0)
END AS result; But the generated Go code returns an |
Looks like #2238 may have fixed this issue. I don't have time to build from source and see, but hopefully should be included in the next release. |
@Sub6Resources you're right! I gave a try to Here was my usecase: https://play.sqlc.dev/p/5dabc6d1291c706bc3d65181b53dc138714136785e958d02368aeedbca85764e |
Version
1.17.2
What happened?
sqlc generate fails in MySQL if there is a CASE statement as a SELECT field.
Relevant log output
Database schema
SQL queries
Configuration
No response
Playground URL
https://play.sqlc.dev/p/5aeef78626b3adaf91194dfd05854ca22d717e15114c01f8bb21d98826a39848
What operating system are you using?
No response
What database engines are you using?
MySQL
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: