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

sqlc.arg clashing with reserved keywords #3867

Open
konstantinB1 opened this issue Mar 2, 2025 · 0 comments
Open

sqlc.arg clashing with reserved keywords #3867

konstantinB1 opened this issue Mar 2, 2025 · 0 comments
Labels
📚 postgresql enhancement New feature or request

Comments

@konstantinB1
Copy link

konstantinB1 commented Mar 2, 2025

What do you want to change?

When using reserved keywords inside sqlc.arg, like:

...
LIMIT sqlc.arg(limit)::int OFFSET sqlc.arg(offset)::int;

It is throwing an invalid error synthax, because limit, and offset are exclusive and reserved to database syntax (in my case POSTGRES).

Proposal

Either parse a sqlc.arg argument as a String synthax, and treat arguments wrapped with String notation as a literal, OR make parameter args unreserved.
Not sure is this a simple task, since you would probably have to "clean up" arguments, then parse/verify the query validity, and then reinject the args, in order for it to work. Not sure how internals parse it.

If its too much hassle just close it, would be nice tho if i could have nice intention in params to know what the param is about. But not a big deal really.

What database engines need to be changed?

This is not exclusive to Postgres, probably every SQL based distro

What programming language backends need to be changed?

Golang

@konstantinB1 konstantinB1 added the enhancement New feature or request label Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 postgresql enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant