Repository navigation
fix: send a null binary value to msnodesqlv8 as a varbinary null - #1995
Merged
Merged
Conversation
The msnodesqlv8 request sent a null Binary, VarBinary or Image value as an empty Buffer. msnodesqlv8 binds a bare null as a char, and the server does not convert a char to a binary type. msnodesqlv8 before 6.3.0 sent an empty Buffer as NULL, so the empty Buffer worked as a NULL. msnodesqlv8 6.3.0 sends an empty Buffer as an empty value. A null input then arrived as zeros in a binary(n), and as an empty value in a varbinary or an image. The request now binds a null binary value as msnodesqlv8's VarBinary(null). Every supported version of msnodesqlv8 sends that as a varbinary NULL, which the server converts to binary, varbinary and image. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dhensby
marked this pull request as ready for review
December 2, 2026 10:26
|
🎉 This PR is included in version 12.8.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
What this does:
Since msnodesqlv8 6.3.0 was published on 2026-11-28, the "Run msnodesqlv8 v6 tests" step fails the
binary datatest on every PR. A nullsql.Binaryinput comes back as<Buffer 00 00 00 00>, notnull.The cause is in the msnodesqlv8 request. It sent a null
Binary,VarBinaryorImagevalue as an empty Buffer. That worked only because msnodesqlv8 before 6.3.0 sent an empty Buffer as NULL: the Buffer had no data pointer, and ODBC reads a null pointer as NULL. msnodesqlv8 6.3.0 fixed that (TimelordUK/node-sqlserver-v8#533), so it now sends an empty Buffer as an empty value. The server pads an empty value with zeros in abinary(n), and keeps it empty in avarbinaryor animage.The request cannot send a bare
nullinstead. msnodesqlv8 binds a barenullas achar, and the server rejects that for a binary type with error 257 ("Implicit conversion from data type char to binary is not allowed").The request now binds a null binary value as
msnodesql.VarBinary(null). Every msnodesqlv8 version from 2.4.8 to 6.3.0 exportsVarBinary, and binds it as a typed varbinary NULL (varbinary(max)before 6.3.0,varbinary(1)from 6.3.0). The server converts a varbinary NULL tobinary,varbinaryandimage.sql.Binary(4),nullnullnull<Buffer 00 00 00 00>nullsql.VarBinary,nullnullnull<Buffer >nullsql.Image,nullnullnull<Buffer >nullAn empty Buffer that the caller gives still goes to msnodesqlv8 as an empty Buffer. msnodesqlv8 6.3.0 sends it as an empty value, as tedious does. Earlier versions send it as NULL. This change does not affect that.
Evidence:
queryRawfor thebinary datatest. Then I replayed them through tedious on SQL Server, with each value bound as msnodesqlv8 6.2.2 or 6.3.0 binds it (from the driver source).in2=00000000,in4= empty andin6= empty. The 6.2.2 replay givesnullfor all three.nullfor all three.in4andin6also fail on 6.3.0. The test stops atin2, so CI shows only that one.Tests:
msnodesqlv8 query eventsharness): a nullBinary,VarBinaryandImageinput is bound asVarBinary(null), and an empty Buffer is bound as an empty Buffer. The first test fails on master.binary dataintegration test covers the server side. It fails on master with msnodesqlv8 6.3.0. CI runs it here on msnodesqlv8 2 to 6.npm run lintandnpm run test-unit(576 passing) pass.Related issues:
This failure shows on #1992 and on the Dependabot PRs opened since 2026-11-28. It needs no pin of msnodesqlv8: master keeps
^6.Pre/Post merge checklist:
🤖 Generated with Claude Code