sqltyper icon indicating copy to clipboard operation
sqltyper copied to clipboard

LIMIT param type is string

Open rob0rt opened this issue 2 years ago • 1 comments

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.

rob0rt avatar Sep 28 '21 20:09 rob0rt

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.

akheron avatar Sep 30 '21 16:09 akheron