insert: VALUES accept typegres expressions (parity with SET)#91
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR brings INSERT ... VALUES to parity with UPDATE ... SET by allowing insert rows to accept typegres expressions (e.g., hydrated row columns) in addition to JS primitives. This unblocks composing values from hydrated rows directly into subsequent inserts without needing to unwrap to primitives first.
Changes:
- Widened
InsertRowto acceptTsTypeOfprimitives or same-class typegres expressions (viaStripRequired, matchingSetRow’s shape). - Updated INSERT compilation to embed incoming
SqlValueexpressions directly via.toSql()instead of attempting to re-wrap them as parameters. - Added a regression test proving a hydrated column can flow into another table’s
VALUES.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/types/runtime.ts | Widens InsertRow value types to allow same-class typegres expressions (matching SetRow). |
| src/builder/insert.ts | Inserts now inline SqlValue inputs via toSql() rather than passing them through from(...). |
| src/builder/insert.test.ts | Adds coverage for inserting with hydrated-column expressions in VALUES. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ryanrasti
force-pushed
the
ryan_1_capnweb_shim
branch
from
July 23, 2026 00:12
3940059 to
8515194
Compare
ryanrasti
force-pushed
the
ryan_2_insert_expressions
branch
from
July 23, 2026 00:13
39617e4 to
6a3ae9a
Compare
InsertRow widens each column to `TsTypeOf | StripRequired` (same shape as SetRow), and the compile path embeds an incoming SqlValue via toSql() instead of re-wrapping it as a param. A hydrated column from one row now composes straight into another table's insert — no unwrap-to-primitive step. Covered in insert.test.ts. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ryanrasti
force-pushed
the
ryan_2_insert_expressions
branch
from
July 23, 2026 00:17
6a3ae9a to
3a5a8d4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
InsertRow widens each column to
TsTypeOf | StripRequired(same shape as SetRow), and the compile path embeds an incoming SqlValue via toSql() instead of re-wrapping it as a param. A hydrated column from one row now composes straight into another table's insert — no unwrap-to-primitive step. Covered in insert.test.ts.