Hi all,

While looking at this area of the code, I have noticed that the new
"squashing" test is not consistent with the rest of the test suite,
re-creating the extension for nothing.

The structure of the test is to have the "cleanup" phase second to
last, so as there is no need to create multiple times the extensions.

In passing, I'd like to suggest that REGRESS in the Makefile uses one
item per line, to minimize diffs when we add new stuff.

Any thoughts or objections about the attached?
Thanks,
--
Michael
From 53420990da3744105b17b75586107e33041cba27 Mon Sep 17 00:00:00 2001
From: Michael Paquier <[email protected]>
Date: Tue, 20 Jan 2026 08:31:56 +0900
Subject: [PATCH] pg_stat_statements: Clean up test logic

The test "squashing" has been added as the last item of the REGRESS
list, but "cleanup" should be the last one, dropping the extension.

In passing, the REGRESS list is cleaned up to include one item per line,
so as diffs are minimized when adding new test files.
---
 contrib/pg_stat_statements/Makefile           | 21 ++++++++++++++++---
 .../pg_stat_statements/expected/squashing.out |  1 -
 contrib/pg_stat_statements/meson.build        |  3 ++-
 contrib/pg_stat_statements/sql/squashing.sql  |  1 -
 4 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/contrib/pg_stat_statements/Makefile b/contrib/pg_stat_statements/Makefile
index fe0478ac5526..5bf99ed50d8c 100644
--- a/contrib/pg_stat_statements/Makefile
+++ b/contrib/pg_stat_statements/Makefile
@@ -19,9 +19,24 @@ PGFILEDESC = "pg_stat_statements - execution statistics of SQL statements"
 LDFLAGS_SL += $(filter -lm, $(LIBS))
 
 REGRESS_OPTS = --temp-config $(top_srcdir)/contrib/pg_stat_statements/pg_stat_statements.conf
-REGRESS = select dml cursors utility level_tracking planning \
-	user_activity wal entry_timestamp privileges extended \
-	parallel plancache cleanup oldextversions squashing
+
+# Note: Test "cleanup" is kept second to last, removing the extension.
+REGRESS = select \
+	dml \
+	cursors \
+	utility \
+	level_tracking \
+	planning \
+	user_activity \
+	wal entry_timestamp \
+	privileges \
+	extended \
+	parallel \
+	plancache \
+	squashing \
+	cleanup \
+	oldextversions
+
 # Disabled because these tests require "shared_preload_libraries=pg_stat_statements",
 # which typical installcheck users do not have (e.g. buildfarm clients).
 NO_INSTALLCHECK = 1
diff --git a/contrib/pg_stat_statements/expected/squashing.out b/contrib/pg_stat_statements/expected/squashing.out
index 6963a434db97..8438235a2ce0 100644
--- a/contrib/pg_stat_statements/expected/squashing.out
+++ b/contrib/pg_stat_statements/expected/squashing.out
@@ -1,7 +1,6 @@
 --
 -- Const squashing functionality
 --
-CREATE EXTENSION pg_stat_statements;
 --
 -- Simple Lists
 --
diff --git a/contrib/pg_stat_statements/meson.build b/contrib/pg_stat_statements/meson.build
index 079a8eb5afcf..9d78cb88b7d7 100644
--- a/contrib/pg_stat_statements/meson.build
+++ b/contrib/pg_stat_statements/meson.build
@@ -37,6 +37,7 @@ install_data(
   kwargs: contrib_data_args,
 )
 
+# Note: Test "cleanup" is kept second to last, removing the extension.
 tests += {
   'name': 'pg_stat_statements',
   'sd': meson.current_source_dir(),
@@ -56,9 +57,9 @@ tests += {
       'extended',
       'parallel',
       'plancache',
+      'squashing',
       'cleanup',
       'oldextversions',
-      'squashing',
     ],
     'regress_args': ['--temp-config', files('pg_stat_statements.conf')],
     # Disabled because these tests require
diff --git a/contrib/pg_stat_statements/sql/squashing.sql b/contrib/pg_stat_statements/sql/squashing.sql
index 2100f2d83fd0..fc9e65738738 100644
--- a/contrib/pg_stat_statements/sql/squashing.sql
+++ b/contrib/pg_stat_statements/sql/squashing.sql
@@ -1,7 +1,6 @@
 --
 -- Const squashing functionality
 --
-CREATE EXTENSION pg_stat_statements;
 
 --
 -- Simple Lists
-- 
2.51.0

Attachment: signature.asc
Description: PGP signature

Reply via email to