-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
Dear maintainers,
Thank you for creating and maintaining sql-bricks — it's a concise and flexible SQL builder that we’ve enjoyed using in our project.
We’ve encountered what appears to be a bug when using .values() to append fields after an initial multi-row insert. Specifically, the appended field is only applied to the first row, while subsequent rows receive null for that field.
Reproduction Example
const sql = SqlBricks
.insert('test', [{ type: 'cat' }, { type: 'dog' }])
.values({ create_time: 3 })
.toString();Result:
INSERT INTO test (type, create_time) VALUES ('cat', 3), ('dog', null)Expected:
INSERT INTO test (type, create_time) VALUES ('cat', 3), ('dog', 3)In our use case, this causes inconsistent data and runtime errors. Based on the chaining design of sql-bricks, it would be reasonable to expect .values() to apply to all rows uniformly.
Questions
- Is this behavior considered a bug or working as designed?
- If it’s a bug, is there a recommended workaround or fix?
- Are there any plans to publish a new release that addresses this issue?
We’d be happy to contribute or assist in debugging this further if needed. Thank you again for the great tool!
Metadata
Metadata
Assignees
Labels
No labels