You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Argument name for sqlc.arg() can't be SQL keyword #2832
I tried working around this by adding underscores to my parameter names, but the parameter names are used in the pgx CopyFrom statement instead of the proper column names.
For example, if I use sqlc.arg(user_) it compiles fine, but the resulting code:
changed the title [-]Invalid argument to sqlc.arg() when the argument is `user`[/-][+]Argument name for sqlc.arg() can't be SQL keyword[/+]on Oct 12, 2023
Activity
sgtsquiggs commentedon Oct 11, 2023
I tried working around this by adding underscores to my parameter names, but the parameter names are used in the pgx
CopyFromstatement instead of the proper column names.For example, if I use
sqlc.arg(user_)it compiles fine, but the resulting code:is incorrect - the
insertstatement defines the columns asidandusernotidanduser_.☝️ this is a separate issue I will be filing here: #2833
[-]Invalid argument to sqlc.arg() when the argument is `user`[/-][+]Argument name for sqlc.arg() can't be SQL keyword[/+]kyleconroy commentedon Oct 12, 2023
useris a reserved keyword in PostgreSQL. To get around this limitation, put user in single quotes.https://play.sqlc.dev/p/9fa2777d8a0f6df949672259c122da0687e266745c84d2450bc291a9c701135f