From 896f9df6e0abe98c82393c8d467eb5fda4293245 Mon Sep 17 00:00:00 2001
From: Daniel Gustafsson <dgustafsson@postgresql.org>
Date: Mon, 17 Aug 2026 16:18:56 +0200
Subject: [PATCH v5 3/3] Minor test suite cleanup

A few catalog queries were missing proper schema qualification in the
test_checksums module test suites, and one suite contained a disable
call right before tearing down the test which can be removed.

Backpatch to v19 where the test suite was added.

Author: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://..
Backpatch-through: 19
---
 src/test/modules/test_checksums/t/001_basic.pl            | 4 ++--
 src/test/modules/test_checksums/t/002_restarts.pl         | 4 +---
 src/test/modules/test_checksums/t/003_standby_restarts.pl | 6 +++---
 src/test/modules/test_checksums/t/005_injection.pl        | 4 ++--
 4 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/test/modules/test_checksums/t/001_basic.pl b/src/test/modules/test_checksums/t/001_basic.pl
index 5a16b6fb9e4..4cfa35b6885 100644
--- a/src/test/modules/test_checksums/t/001_basic.pl
+++ b/src/test/modules/test_checksums/t/001_basic.pl
@@ -136,7 +136,7 @@ enable_data_checksums($node);
 
 $node->poll_query_until(
 	'postgres', qq[
-	SELECT count(*) > 0 FROM pg_stat_activity
+	SELECT count(*) > 0 FROM pg_catalog.pg_stat_activity
 	WHERE backend_type = 'datachecksums worker' AND datname = 'postgres'
 	  AND query LIKE 'Waiting for % temp tables to be removed']
 ) or die "timed out waiting for worker to wait for temporary tables";
@@ -180,7 +180,7 @@ enable_data_checksums($node);
 
 $node->poll_query_until(
 	'postgres', qq[
-	SELECT count(*) > 0 FROM pg_stat_activity
+	SELECT count(*) > 0 FROM pg_catalog.pg_stat_activity
 	WHERE backend_type = 'datachecksums worker' AND datname = 'dropmeforce'
 	  AND query LIKE 'Waiting for % temp tables to be removed']
 ) or die "timed out waiting for worker to wait for temporary tables";
diff --git a/src/test/modules/test_checksums/t/002_restarts.pl b/src/test/modules/test_checksums/t/002_restarts.pl
index ee0f300c899..8c70e6f4d2c 100644
--- a/src/test/modules/test_checksums/t/002_restarts.pl
+++ b/src/test/modules/test_checksums/t/002_restarts.pl
@@ -105,11 +105,9 @@ is($result, '9999', 'ensure checksummed pages can be read back');
 
 $result = $node->poll_query_until(
 	'postgres',
-	"SELECT count(*) FROM pg_stat_activity WHERE backend_type LIKE 'datachecksums%';",
+	"SELECT count(*) FROM pg_catalog.pg_stat_activity WHERE backend_type LIKE 'datachecksums%';",
 	'0');
 is($result, 1, 'await datachecksums worker/launcher termination');
 
-disable_data_checksums($node, wait => 1);
-
 $node->stop;
 done_testing();
diff --git a/src/test/modules/test_checksums/t/003_standby_restarts.pl b/src/test/modules/test_checksums/t/003_standby_restarts.pl
index bb35ed0b325..ca06cf61ef1 100644
--- a/src/test/modules/test_checksums/t/003_standby_restarts.pl
+++ b/src/test/modules/test_checksums/t/003_standby_restarts.pl
@@ -95,7 +95,7 @@ is($result, '19998', 'ensure we can safely read all data with checksums');
 
 $result = $node_primary->poll_query_until(
 	'postgres',
-	"SELECT count(*) FROM pg_stat_activity WHERE backend_type LIKE 'datachecksums%';",
+	"SELECT count(*) FROM pg_catalog.pg_stat_activity WHERE backend_type LIKE 'datachecksums%';",
 	'0');
 is($result, 1, 'await datachecksums worker/launcher termination');
 
@@ -145,9 +145,9 @@ $node_primary->wait_for_catchup($node_standby, 'replay',
 
 # Get the relfilenode and database OID so we can inspect the filesystem
 my $unlogged_rfn = $node_primary->safe_psql('postgres',
-	"SELECT relfilenode FROM pg_class WHERE relname = 'unlogged_tbl';");
+	"SELECT relfilenode FROM pg_catalog.pg_class WHERE relname = 'unlogged_tbl';");
 my $db_oid = $node_primary->safe_psql('postgres',
-	"SELECT oid FROM pg_database WHERE datname = 'postgres';");
+	"SELECT oid FROM pg_catalog.pg_database WHERE datname = 'postgres';");
 
 # Verify the standby only has the init fork (no main fork)
 my $standby_datadir = $node_standby->data_dir;
diff --git a/src/test/modules/test_checksums/t/005_injection.pl b/src/test/modules/test_checksums/t/005_injection.pl
index 60bb716d922..c942ded701f 100644
--- a/src/test/modules/test_checksums/t/005_injection.pl
+++ b/src/test/modules/test_checksums/t/005_injection.pl
@@ -98,7 +98,7 @@ my $dropdb_log_offset = -s $node->logfile;
 enable_data_checksums($node);
 $node->poll_query_until(
 	'postgres', qq[
-	SELECT count(*) > 0 FROM pg_stat_activity
+	SELECT count(*) > 0 FROM pg_catalog.pg_stat_activity
 	WHERE backend_type = 'datachecksums worker' AND datname = 'postgres'
 	  AND query LIKE 'Waiting for % temp tables to be removed']
 ) or die "timed out waiting for worker to wait for temporary tables";
@@ -125,7 +125,7 @@ $node->safe_psql('postgres',
 	"SELECT injection_points_detach('dropdb-after-invalid-marker');");
 
 my $invalid_state = $node->safe_psql('postgres',
-	"SELECT datconnlimit FROM pg_database WHERE datname = 'invalid_dropdb';");
+	"SELECT datconnlimit FROM pg_catalog.pg_database WHERE datname = 'invalid_dropdb';");
 is($invalid_state, '-2', 'interrupted DROP left an invalid database row');
 
 # Let checksum processing continue.  The invalid database must be treated as
-- 
2.39.3 (Apple Git-146)

