Repository navigation
fix: INSERT without a column list stores NaN instead of NULL in numeric columns - #2563
Closed
harsh-thakkar7 wants to merge 1 commit into
Closed
harsh-thakkar7 wants to merge 1 commit into
harsh-thakkar7 wants to merge 1 commit into
Conversation
Author
|
Closing this PR — it's been open with no maintainer movement for several days, and I don't want to leave noise in the queue. If the change is still wanted, I'm happy to reopen or resubmit with any requested adjustments. Thanks for the repo! |
This was referenced Oct 14, 2026
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.
Problem
INSERT INTO t VALUES (NULL)against a table with a numeric column (INT/FLOAT/NUMBER/MONEY) storesNaNinstead of NULL when no column list is given:Standard functions like
IS NULLandCOALESCEthen behave incorrectly on those rows.The same statement with a column list (
INSERT INTO t (v) VALUES (NULL)) works correctly and storesundefined(NULL).Root cause
In the no-column-list branch of the INSERT compiler (
src/70insert.js), numeric columns are compiled as:A
NULLvalue compiles toundefined, and+undefinedyields NaN. Every other path in the same function already guards this:The fix applies that identical guard to the no-column-list branch, so NULL is stored as
undefinedand retains the existing numeric coercion for real values.Tests
test/test2229.js:WHERE v IS NULL, numbers are still coerced to numbersFull suite: 2242 pass / 0 fail / 213 skip.