Skip to content

Keep NULL in numeric columns on INSERT without column list to close #2590 - #2957

Open
maslianok wants to merge 1 commit into
AlaSQL:developfrom
maslianok:gitranks/2590-insert-without-a-column-list-stores
Open

maslianok wants to merge 1 commit into
AlaSQL:developfrom
maslianok:gitranks/2590-insert-without-a-column-list-stores

Conversation

@maslianok

@maslianok maslianok commented Nov 4, 2026 •

Copy link
Copy Markdown

Closes #2590 (item 1: INSERT stores NULL as NaN or 0).

INSERT INTO t VALUES (...) without a column list converted values for INT, FLOAT, NUMBER and MONEY columns with a bare +. That turned a NULL literal into NaN and a null parameter into 0. Because of this, IS NULL, COUNT and NOT NULL gave wrong results. The path with a column list already guards NULL with (x=value, x==undefined?undefined:+x). This PR uses the same guard in the path without a column list (one line in src/70insert.js).

Tests: test/test2590.js covers a NULL literal, a null parameter and a column list for INT, FLOAT, NUMBER, MONEY and for comparison types (INTEGER, DECIMAL, REAL, STRING, DATE). It also covers IS NULL and COUNT on the stored value, the numeric conversion of non-NULL values, and NOT NULL being enforced (the case from the 2026-10-21 comment). Six of its tests fail without the fix. The full suite passes with it.

Not in this PR: CAST of a NULL still returns 0 on develop, because #2576 is not merged here. Item 2 (null vs undefined) depends on the v5 decision in #2588. In a numeric column, a null parameter is now stored as undefined, the same as the column-list path already does.

Made with GitRanks Contribute powered by Claude (Opus) · Reviewed and submitted by @maslianok
Something off? Tell us or opt out in one step — maintainers are always in control

…laSQL#2590

Co-authored-by: gitranks[bot] <198371943+gitranks[bot]@users.noreply.github.com>
@mathiasrw mathiasrw added this to the v5.0.0 milestone Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

INSERT without a column list stores NULL as NaN or 0 in INT, FLOAT, NUMBER and MONEY columns

2 participants