Add automatic type cast for integer literals

In parameterized statements integer literals, like Int(num), are replaced with a placeholders. For some expressions,
postgres interpreter will not have enough information to deduce the type. If this is the case postgres returns an error.
Int8, Int16, Int32.... functions now will add automatic type cast over a placeholder, so type deduction is always possible.
This commit is contained in:
go-jet 2021-12-26 17:15:43 +01:00
parent 47545ce571
commit 01305a138f
10 changed files with 146 additions and 106 deletions

View file

@ -29,7 +29,7 @@ ON CONFLICT (col_bool) ON CONSTRAINT table_pkey DO NOTHING`)
)
assertClauseSerialize(t, onConflict, `
ON CONFLICT (col_bool, col_float) WHERE (col_float + col_int) > col_float DO UPDATE
SET col_bool = $1,
SET col_bool = $1::boolean,
col_int = $2
WHERE table2.col_float > $3`)
}