Skip to content

Argument name for sqlc.arg() can't be SQL keyword #2837

Answered by kyleconroy
sgtsquiggs asked this question in Q&A
Discussion options

You must be logged in to vote

user is a reserved keyword in PostgreSQL. To get around this limitation, put user in single quotes.

-- name: StageUserData :copyfrom
insert into "user_data" ("id", "user")
values (sqlc.arg('id'), sqlc.arg('user'));

https://play.sqlc.dev/p/9fa2777d8a0f6df949672259c122da0687e266745c84d2450bc291a9c701135f

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@sgtsquiggs
Comment options

Answer selected by kyleconroy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
bug Something isn't working 📚 postgresql
2 participants
Converted from issue

This discussion was converted from issue #2832 on October 12, 2023 17:35.