Array spread and pick infers wrong type when used as insert into ... select from (values :rows) as t
#498
Labels
bug
Something isn't working
Describe the bug
When using array spread and pick variable called
rows
, as follows:insert into ... select ... from (values :rows) as t (col1, col2)
, the types of col1 and col2 are automatically assumed to be string, even though there are number type columns in the inserted table.Expected behavior
I would expect the type of the
rows
would be inferred appropriately. If this is due to postgres engine, I believe there should be a way to declare the types of the array spread and pick variables.Test case
issue
table's columns:id
is TEXT, andbadge_id
is INT.Here is the error I get when I try to generate ts from above query:
I tried explicitly type casting as
Even though this removes error and successfully generates the ts, the params interface has
badgeId
as string.Note: I simplified my original query as above for it to be easily readable.
The text was updated successfully, but these errors were encountered: