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

LIMIT param type is string #317

Open
rob0rt opened this issue Sep 28, 2021 · 1 comment
Open

LIMIT param type is string #317

rob0rt opened this issue Sep 28, 2021 · 1 comment

Comments

@rob0rt
Copy link
Contributor

rob0rt commented Sep 28, 2021

in the following query:

SELECT *
FROM foo
LIMIT ${count}

count will be added as a parameter with type string, though I'd expect it to be of type number.

@akheron
Copy link
Owner

akheron commented Sep 30, 2021

LIMIT expects a bigger int than what fits to a JavaScript number (perhaps u64), and thus node-postgres uses string instead of number.

I don’t think there’s an obvious fix for this in the sqltyper side. We have to adhere to the type conversions of node-postgres.

You can of course tweak the query to have LIMIT ${count}::int to get it inferred as number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants