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:
parent
47545ce571
commit
01305a138f
10 changed files with 146 additions and 106 deletions
|
|
@ -165,7 +165,7 @@ VALUES ('one', 'two'),
|
|||
('1', '2'),
|
||||
('theta', 'beta')
|
||||
ON CONFLICT (col_bool) WHERE col_bool IS NOT FALSE DO UPDATE
|
||||
SET col_bool = TRUE,
|
||||
SET col_bool = TRUE::boolean,
|
||||
col_int = 1,
|
||||
(col1, col_bool) = ROW(2, 'two')
|
||||
WHERE table1.col1 > 2
|
||||
|
|
@ -191,7 +191,7 @@ INSERT INTO db.table1 (col1, col_bool)
|
|||
VALUES ('one', 'two'),
|
||||
('1', '2')
|
||||
ON CONFLICT ON CONSTRAINT idk_primary_key DO UPDATE
|
||||
SET col_bool = FALSE,
|
||||
SET col_bool = FALSE::boolean,
|
||||
col_int = 1,
|
||||
(col1, col_bool) = ROW(2, 'two')
|
||||
WHERE table1.col1 > 2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue