Keep an all-hex temp table name whole - #585
Conversation
CleanTempTableName found an internal temp table name's hex suffix by skipping trailing hex digits. For a name that is all hex after the #, such as #deadbeef1 or a table variable's internal name like #A1B2C3D4, the skip ran to the start and the name came back as a bare #. Ported from PerformanceMonitor b31e5d18: a name with no underscore padding before its hex run is returned unchanged, and the function never returns a bare #. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G625JBNh45iTR1hpT4CxNR
|
Reviewed. This is a clean, minimal fix — traced the guard logic by hand against several inputs and it holds up:
Minor, non-blocking: that last all-underscore scenario isn't covered by a test case (the 6 "unchanged" cases all hit the earlier No concerns with the three call sites ( |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G625JBNh45iTR1hpT4CxNR
|
Reviewed. Traced the new guard logic against all test cases by hand — the |
What does this PR do?
CleanTempTableNameno longer turns a short hex-like name into a bare#.SQL Server stores a #temp table under an internal name. That name is the table's own name, padded with underscores to 116 characters, with a 12-character hex suffix after it. Plans show that internal name.
CleanTempTableNamestrips the padding and the suffix. It found the suffix by skipping trailing hex digits. For a name that is all hex after the#, that skip ran to the start of the name. So#deadbeef1came back as#, and so did a table variable's internal name such as#A1B2C3D4.PerformanceMonitor fixed this in its copy of the parser (commit b31e5d18, "Fix shared-lib defects found in Fable code review"). This PR ports the same guard:
#.The function has three callers, so the wrong name reached three places:
ShowPlanParser.RelOp.cs)ShowPlanParser.Warnings.cs)PlanAnalyzer.Detection.cs)An audit of the analyzer code in the two repos found this item. The audit compares PerformanceStudio and PerformanceMonitor in both directions.
Which component(s) does this affect?
How was this tested?
TempTableNameTests, 10 cases:#deadbeefwith its padding and suffix, so an all-hex table name still comes back whole.#deadbeef1,#A1B2C3D4,#OldUsers,#t,##globalandUsers. Before this change, the first two came back as#.#and the suffix comes back whole. Before this change, it came back as#. The review asked for this case.Checklist
dotnet test)dotnet test)🤖 Generated with Claude Code
https://claude.ai/code/session_01G625JBNh45iTR1hpT4CxNR