Skip to content

fix: warnings the driver attaches to a fetch or execute are no longer dropped - #494

Merged
TimelordUK merged 4 commits into
masterfrom
fix/info-dropped-on-fetch
Oct 22, 2026
Merged

TimelordUK merged 4 commits into
masterfrom
fix/info-dropped-on-fetch

Conversation

@TimelordUK

Copy link
Copy Markdown
Owner

Summary

Warnings SQL Server raises at the end of a result set were dropped every time:
8153 "Null value is eliminated by an aggregate", 3607 "Division by zero occurred",
3606 "Arithmetic overflow occurred". msodbcsql attaches them to the SQLFetch that
returns SQL_NO_DATA (and, for a prepared execution, to SQLExecute), and neither
was read. A fetch or bind that succeeded had no way to pass diagnostics to JS.

  • native: keep_diagnostics() reads the records of a call that did not fail, on
    SQL_NO_DATA / SQL_SUCCESS_WITH_INFO from SQLFetch, SQLFetchScroll,
    SQLMoreResults, and SQLExecute in bind_fetch. TryReadRows starts clean.
  • FetchRowsWorker and BindQueryWorker call back (info, result), as NextResultWorker does.
  • bind_fetch resets the result set's end flags after each execute: with info, the
    previous execution's flags made the next one look finished and its rows were lost.
  • reader.js emits a batch's info after its rows, in the server's order; a pause holds it.

1756 (FK on a temp table), thought lost, is a compile-time warning: a cached plan
raises none. PRINT / RAISERROR were always delivered.

Tests

  • New corpus group info/ (45 transcripts) and scripts/prepared-info, with native
    recordings. Expected order checked against .NET SqlClient (TDS, no ODBC).
  • warnings.test.js expected no info for a null-eliminating query; it now expects the 8153.
  • cancel/after-error-mid-batch gets an --- or for the known cancel-cb / HY008 race (also on master).
  • Full suite locally: 1169 passing.
  • node-mssql's msnodesqlv8 suite against this branch (SNAC 11): master 155 passing,
    12.7.10 155, 12.7.7 154; the 2 failures are SQL-login tests LocalDB can't run.
    test/contract/mssql/tap.js records how their suite drives us.
  • release-notes.js reads PR titles from merge commits.

🤖 Generated with Claude Code

TimelordUK and others added 4 commits October 22, 2026 08:13
… worked

msodbcsql hands a warning raised at the end of a result set (8153 null value
eliminated, 3607 division by zero, 3606 arithmetic overflow) to the SQLFetch
that returns SQL_NO_DATA, and for a prepared execution to SQLExecute
(SQL_SUCCESS_WITH_INFO). Neither was read, and a fetch or bind that worked
had no way to pass diagnostics to JS, so these were dropped every time.

- native: keep_diagnostics() appends the records of a call that did not fail;
  called on SQL_NO_DATA / SQL_SUCCESS_WITH_INFO from SQLFetch, SQLFetchScroll,
  SQLMoreResults and bind_fetch's SQLExecute. TryReadRows starts clean.
- FetchRowsWorker and BindQueryWorker call back (info, result), as
  NextResultWorker does.
- bind_fetch resets the result set's end flags after an execute: with info,
  the last execution's flags made the next one look finished, losing its rows.
- reader.js keeps a batch's info with the batch and emits it after its rows,
  in the server's order; a pause holds it.

1756 (FK on a temp table), thought lost, is a compile-time warning: a cached
plan raises none. Scenarios can put {unique} in their text for this.

Adds the info/ corpus group and scripts/prepared-info, with native recordings.
warnings.test.js expected no info for a null-eliminating query; it now
expects the 8153. cancel/after-error-mid-batch gets an --- or alternative for
the known cancel-cb / HY008 race (also on master).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…st v6

test/contract/mssql/tap.js, loaded into node-mssql's mocha run with --require,
records every call node-mssql makes on msnodesqlv8 and the events it saw, per
test, in the corpus's transcript format. Their suite passes against this
branch on node-mssql master, 12.7.10 and 12.7.7 (SNAC 11), bar two SQL-login
tests LocalDB can't run. The handover notes node-mssql's own 'done' after a
paused cancel, now a second 'done' under v6.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
PRs since 5.6.0 were merged with merge commits, so 'What's changed' listed
'Merge pull request #N from ...' under Other. Take the PR title from the merge
commit's body, and skip 'Merge branch' commits.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On Linux an error at execute ends the batch, so the print and result set
after it are lost - the same #483 as the other Linux pins.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@TimelordUK
TimelordUK merged commit 04ea47b into master Oct 22, 2026
11 checks passed
TimelordUK added a commit that referenced this pull request Oct 22, 2026
…arnings

Warnings SQL Server raises at the end of a result set (8153, 3606, 3607)
are delivered as info from 6.0.0 (#494). The driver hands them over on the
fetch that finds no more rows (SQL_NO_DATA), and the unixODBC driver
manager before 2.3.12 discards them there. Verified with a plain C ODBC
probe on Ubuntu 22.04: same msodbcsql18 18.7.1.1 and the same server, no
record under the system 2.3.9, the 8153 under 2.3.12. With 2.3.12 the
contract suite passes in full on WSL, as it does on CI (ubuntu-24.04).

The template now carries a standing known-issue section, with how to check
the loaded version and how to install 2.3.12 into /usr/local on 22.04.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

1 participant