Skip to content

Commit 71c0f4f

Browse files
Merge pull request #1106 from erikdarlingdata/feature/code-review-sql-collectors
Fix high-impact SQL collector defects from Fable code review (chunk 5)
2 parents f6839f6 + 6337da4 commit 71c0f4f

5 files changed

Lines changed: 11 additions & 4 deletions

install/06_ensure_collection_table.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,9 @@ BEGIN
11571157
is_clustered bit NULL,
11581158
enterprise_features nvarchar(max) NULL,
11591159
service_objective sysname NULL,
1160+
lock_pages_in_memory bit NULL,
1161+
instant_file_initialization_enabled bit NULL,
1162+
memory_dump_count integer NULL,
11601163
row_hash binary(32) NULL,
11611164
CONSTRAINT
11621165
PK_server_properties

install/09_collect_query_store.sql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,12 @@ BEGIN
662662
avg_tempdb_space_used,
663663
min_tempdb_space_used,
664664
max_tempdb_space_used,
665-
plan_type,
665+
/* Order must match the dynamic SELECT, which is bound by ordinal by
666+
INSERT...EXEC: the 2017+ block emits plan_forcing_type before the 2022+
667+
block emits plan_type. Swapping these silently stores each in the other's
668+
column. */
666669
plan_forcing_type,
670+
plan_type,
667671
is_forced_plan,
668672
force_failure_count,
669673
last_force_failure_reason_desc,

install/23_process_blocked_process_xml.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ BEGIN
7575
SET @sql = N'
7676
IF OBJECT_ID(N''' + QUOTENAME(@procedure_database) + N'.dbo.sp_HumanEventsBlockViewer'', N''P'') IS NOT NULL
7777
BEGIN
78-
SELECT @blockviewer_database = N''' + QUOTENAME(@procedure_database) + N''';
78+
SELECT @blockviewer_database = N''' + REPLACE(@procedure_database, '''', '''''') + N''';
7979
END;';
8080

8181
EXECUTE sys.sp_executesql

install/25_process_deadlock_xml.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ BEGIN
7373
SET @sql = N'
7474
IF OBJECT_ID(N''' + QUOTENAME(@procedure_database) + N'.dbo.sp_BlitzLock'', N''P'') IS NOT NULL
7575
BEGIN
76-
SELECT @blitzlock_database = N''' + QUOTENAME(@procedure_database) + N''';
76+
SELECT @blitzlock_database = N''' + REPLACE(@procedure_database, '''', '''''') + N''';
7777
END;';
7878

7979
EXECUTE sys.sp_executesql

install/28_collect_system_health_wrapper.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ BEGIN
6969
SET @sql = N'
7070
IF OBJECT_ID(N''' + QUOTENAME(@procedure_database) + N'.dbo.sp_HealthParser'', N''P'') IS NOT NULL
7171
BEGIN
72-
SELECT @healthparser_database = N''' + QUOTENAME(@procedure_database) + N''';
72+
SELECT @healthparser_database = N''' + REPLACE(@procedure_database, '''', '''''') + N''';
7373
END;';
7474

7575
EXECUTE sys.sp_executesql

0 commit comments

Comments
 (0)