Closed papadp closed 1 year ago
Add an explicit type cast to your arguments. It is usually a bad idea to rely on reverse type inference of arguments:
await conn.execute('''
INSERT INTO test2 (a)
SELECT * FROM (
VALUES ($1::int)
)
AS temp (a)
WHERE (
SELECT count(*)
FROM test
WHERE t != $2::int
) = 0''', 1093, -863)
I'm trying to run the following query as an insert-if
I'm not able to parameterize the VALUES($1) part of the query, when swapping to a hardcoded const my query works well, otherwise I'm getting this error
Running the query in the following way doesn't produce an error: