feat: add native JSON type support for SQL Server 2025#315
Open
dlevy-msft-sql wants to merge 1 commit intomicrosoft:mainfrom
Open
feat: add native JSON type support for SQL Server 2025#315dlevy-msft-sql wants to merge 1 commit intomicrosoft:mainfrom
dlevy-msft-sql wants to merge 1 commit intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds end-to-end support for SQL Server 2025’s native JSON type, including TDS login feature negotiation, session capability tracking, JSON parameter declaration behavior with fallback, and tests/docs.
Changes:
- Introduces
typeJsonhandling in TDS type parsing/metadata and SQL type name/decl generation. - Adds
featExtJSONSUPPORTnegotiation in LOGIN7 and tracksjsonSupportedon the session. - Adds
mssql.JSON/mssql.NullJSONparameter types plus a comprehensive JSON test suite and documentation updates.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
types.go |
Adds JSON type ID, PLP decode path, and type metadata helpers (decl/name/length/prec-scale). |
token.go |
Parses server ACK payload for JSON feature extension. |
tds.go |
Adds JSON feature-ext request/ACK handling, session flag, and deterministic feature-ext ordering. |
tds_login_test.go |
Updates expected LOGIN7 hex blobs to include JSON feature extension and new deterministic ordering. |
mssql_go19.go |
Adds JSON/NullJSON types and parameter encoding with JSON-decl fallback logic. |
mssql.go |
Ensures JSON parameters are handled before driver.Valuer processing. |
json_test.go |
Adds unit + integration tests for JSON parameter behavior, fallback behavior, and declarations. |
README.md |
Documents JSON parameter types, compatibility/fallback behavior, and limitations. |
CHANGELOG.md |
Adds release note entry for JSON support. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #315 +/- ##
==========================================
+ Coverage 75.36% 78.64% +3.27%
==========================================
Files 34 34
Lines 6597 6728 +131
==========================================
+ Hits 4972 5291 +319
+ Misses 1337 1155 -182
+ Partials 288 282 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
440f178 to
7e860f9
Compare
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.
Adds native JSON type support for SQL Server 2025 Preview, enabling proper handling of the new JSON data type.
Features
typeJson = 0xF4) and type parsingfeatureExtJsonSupportfor TDS login negotiationUsage
JSON data is returned as
stringcontaining the JSON document. Supports scanning into:string[]bytemssql.NullJSON(wrapsjson.RawMessage)sql.ScannerRequirements
Split from #306 for easier review