-
Notifications
You must be signed in to change notification settings - Fork 777
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
COALESCE in INSERT results in missing arguments #2748
Comments
I think the bug is sadly worse than your description, and I'll probably update the title. It appears that sqlc fails to generate input parameters for values passed to This playground link updates the one you provided to demonstrate that things work fine in the context of And here's a playground link demonstrating the bug using PostgreSQL as engine and without |
Interestingly this does indeed seem particular to COALESCE. I went back and tried a couple of other functions like substrings (both for postgresql and the mysql variant) but they seem ok. |
The problem occurs because COALESCE is treated as CoalesceExpr instead of FuncCall on ast. |
Fix has been merged, will be included in v1.23.0 |
Version
1.21.0
What happened?
When writing a query like
Only the ? is recognised and add as a parameter to the insert query
Relevant log output
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/8471d8c7965409b41c01510cf680b8026ae5268dc83ae2591e891c432aef0432
What operating system are you using?
macOS
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: