Uh oh!
There was an error while loading. Please reload this page.
sqlite: bind undefined to null - #62008
Conversation
nodejs-github-bot
commented
Feb 26, 2026
Review requested:
|
4cfb494 to
f24c817CompareThis pull request has been marked as stale due to 90 days of inactivity. |
mike-git374
commented
Aug 4, 2026
Not stale, should be merged |
trivikr
commented
Aug 5, 2026
@mike-git374 Can you please sign the commit message and push? It's needed as per updated instructions
|
TrevorBurnham
left a comment
There was a problem hiding this comment.
I think the idea here is solid. The existing inconsistency is easy to miss:
s.run({k: 1});// v binds to NULLs.run({k: 2,v: undefined});// throws ERR_INVALID_ARG_TYPEBinding undefined to NULL is the only way to make this consistent. And SQLite's own WASM oo1 API has the same behavior:
a value of
undefinedas an array or object property when binding an array/object… is treated the same asnull
But I'd like to see a few changes before this lands:
Rebase.
Use the existing
IsNullOrUndefinedhelper, matchingJSValueToSQLiteResult.Update
doc/api/sqlite.md. It currently describes the opposite of the new behavior in three places: the NULL row of the type-conversion table, "Attempting to write an unsupported data type to SQLite will result in an exception", and "Binding any other value throws anERR_INVALID_ARG_TYPEerror". The...anonymousParameters/...boundParameterstype unions also needundefinedadded, plus achanges:entry withpr-urlon each affected method.Add two more test cases to cover
undefinedbeing passed in the named-parameters slot, andundefinedbeing passed beyond the statement's parameter count.Adjust the indentation in the new test block from 8 spaces to 6 to satisfy
@stylistic/js/indent.Add the
Signed-off-byline @trivikr asked about.
trivikr
commented
Aug 12, 2026
@mike-git374 Can you work on the two comments posted above? We're prioritizing reviewing |
Omitting a named parameter binds NULL, but passing `undefined` for that same parameter threw ERR_INVALID_ARG_TYPE. Bind `undefined` to NULL so the two forms agree. This matches the conversion already applied to a user-defined function's `undefined` return value, as well as SQLite's own WASM oo1 API. Fixes: nodejs#61824 Refs: nodejs#61472 Refs: nodejs#62008 Co-authored-by: mike-git374 <217764531+mike-git374@users.noreply.github.com> Assisted-by: claude:opus-5 Signed-off-by: Trevor Burnham <trevorburnham@gmail.com>
TrevorBurnham
commented
Sep 1, 2026
I've sent over another PR to implement this same fix: #65709 |
trivikr
commented
Sep 1, 2026
Closing as commits were cherry-picked and posted in a new PR in #65709 |
Fixes: #61824
Refs: #61472