postgres
postgres copied to clipboard
INSERT multiple sets optional boolean values to all null if first element is null
const equipmentList =
[{
someKey: "value1",
optionalBool: null
},
{
someKey: "value2",
optionalBool: true
},
{
someKey: "value3",
optionalBool: false
}]
await sql`insert into equipment ${sql(listOfThings)}`
Because we used implicit columns and the first element has a null value, the resulting db table winds up with all optionalBool values as null. If the first element has a boolean for optionalBool, the column is saved correctly.
Version 3.4.3
We've worked around it but thought I should report it.