INSERT multiple sets optional boolean values to all null if first element is null
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 8.7k
- Forks
- 374
- Avg merge
- 11d 16h
- Merged PRs (30d)
- 1
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named in the report. Start by reproducing the shown implicit-column insert with the three equipment objects against PostgreSQL, then trace the insert value inference for a leading null. Done means the boolean column preserves null, true, and false per row; add a regression test if the existing test structure is identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, postgresql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100