Commit dc6e56d
Use AND between @Dbid and @database_name filter groups in sp_HealthParser
The deadlock process-list filter combined two "pass-through if NULL"
predicate pairs with OR between them:
WHERE (x.database_id = @Dbid OR @Dbid = NULL)
OR (x.current_database_name = @db OR @db = NULL)
which means "match if either pair's parameter is NULL" — so whenever
one of the two was unsupplied (or both), the whole filter short-
circuited to TRUE, and every row passed regardless of the other
parameter's value. The intent is AND: both filters apply
independently when their parameter is supplied, and each
individually passes through when NULL.
Currently masked in practice because an earlier validation block
aborts the proc when @database_name is set but @Dbid couldn't be
resolved, keeping the two parameters in lockstep. But the shape was
broken and would surface the moment that validation relaxed or
another caller supplied mismatched inputs.
Verified sp_HealthParser installs clean and
@what_to_check = 'deadlocks' @database_name = N'PerformanceMonitor'
runs against system_health without errors on SQL Server 2022.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 731c746 commit dc6e56d
1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5728 | 5728 | | |
5729 | 5729 | | |
5730 | 5730 | | |
| 5731 | + | |
| 5732 | + | |
| 5733 | + | |
| 5734 | + | |
| 5735 | + | |
| 5736 | + | |
| 5737 | + | |
5731 | 5738 | | |
5732 | 5739 | | |
5733 | | - | |
| 5740 | + | |
5734 | 5741 | | |
5735 | 5742 | | |
5736 | 5743 | | |
| |||
0 commit comments