fix report.daily_summary_v2.worst_query_hash sql_variant garbling - #1667
Merged
erikdarlingdata merged 1 commit intoJul 26, 2026
Conversation
- boxing raw binary(8) query_hash into sql_variant makes CONVERT(nvarchar,...) reinterpret the bytes as UTF-16, producing garbage instead of a hash - convert to hex nvarchar before boxing, matching the style already used elsewhere in the codebase for query_hash display
This was referenced Jul 26, 2026
erikdarlingdata
added a commit
that referenced
this pull request
Jul 26, 2026
…and-view-smoke Add the missing CHANGELOG entry for #1667
pull Bot
pushed a commit
to ehtick/PerformanceMonitor
that referenced
this pull request
Jul 29, 2026
The merged fix had no [Unreleased] entry. Records the behaviour change as well as the fix: that one row's sql_variant base type goes from binary(8) to nvarchar(20), so anyone querying the view directly and converting to varbinary needs to adjust -- though the old value was garbled and therefore unusable, which is the bug being fixed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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 does this PR do?
Fixes #1666. The view boxes the raw
binary(8)query_hashcolumn directly into thesql_variantpivot column:CONVERT(sql_variant, wq.query_hash). Any caller that follows the view's own documented usage and convertsmetric_valuestraight tonvarchargets the raw bytes reinterpreted as UTF-16 instead of a readable hash - every other row in the view is a scalar and converts cleanly; only this one row carries a binary payload.Which component(s) does this affect?
How was this tested?
mcr.microsoft.com/mssql/server:2022-latestcontainer:binary(8)query hash intosql_variantthe way the unfixed view does, then converted tonvarchar- produced garbled text (稟띿坧謈), reproducing the bug.CONVERT(nvarchar(20), ..., 1)before boxing) against the same literal - produced the correct hex string (0x1F7A7FB76757088B).BuildandSQL ValidationGitHub Actions workflows triggered against this branch via a fork-internal PR.SQL Server version(s) tested against: SQL Server 2022 (Docker,
:latesttag)Checklist
dotnet build -c Debug)