-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
numeric arguments in prepared statements are sent to postgres as strings. I'm not sure why this is important, but it causes the following case to fail:
client.query('SELECT * FROM numbers WHERE n > $1', [123.456])
where numbers.n
is of type int
, bigint
, etc. Since 123.456
is sent as a string, postgres interprets this like WHERE n > '123.456'::int
which fails with the following error:
error: invalid input syntax for integer: "123.456"
Preparing the query manually, as follows, works without a hitch:
client.query('SELECT * FROM numbers WHERE n > 123.456')
A test case is incoming.
Metadata
Metadata
Assignees
Labels
No labels