Hi all,
(Added Bruce and Julien in CC)

While testing installcheck with various server configurations to see
how the main regression test suites could break, I found that loading
pg_stat_statements into the backend is enough to break installcheck
as compute_query_id = auto, the default, lets the decision to compute
query IDs to pg_stat_statements itself.  In short, loading
pg_stat_statements breaks EXPLAIN outputs of any SQL-based regression
test.

Running installcheck on existing installations is a popular sanity
check, as much as is enabling pg_stat_statements by default, so it
seems to me that we'd better disable compute_query_id by default in
the databases created for the sake of the regression tests, enabling
it only in places where it is relevant.  We do that in explain.sql for
a test with compute_query_id, but pg_stat_statements does not do
that.

I'd like to suggest a fix for that, by tweaking the tests of
pg_stat_statements to use compute_query_id = auto, so as we would
still stress the code paths where the module takes the decision to
compute query IDs, while the default regression databases would
disable it.  Please note that this also fixes the case of any
out-of-core modules that have EXPLAIN cases.

The attached is enough to pass installcheck-world, on an instance
where pg_stat_statements is loaded.

Thoughts?
--
Michael
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index e6f71c7582..f305a4e57a 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -1925,8 +1925,9 @@ create_database(const char *dbname)
 					 "ALTER DATABASE \"%s\" SET lc_numeric TO 'C';"
 					 "ALTER DATABASE \"%s\" SET lc_time TO 'C';"
 					 "ALTER DATABASE \"%s\" SET bytea_output TO 'hex';"
+					 "ALTER DATABASE \"%s\" SET compute_query_id TO 'off';"
 					 "ALTER DATABASE \"%s\" SET timezone_abbreviations TO 'Default';",
-					 dbname, dbname, dbname, dbname, dbname, dbname);
+					 dbname, dbname, dbname, dbname, dbname, dbname, dbname);
 	psql_end_command(buf, "postgres");
 
 	/*
diff --git a/contrib/pg_stat_statements/expected/oldextversions.out b/contrib/pg_stat_statements/expected/oldextversions.out
index f18c08838f..ff20286db7 100644
--- a/contrib/pg_stat_statements/expected/oldextversions.out
+++ b/contrib/pg_stat_statements/expected/oldextversions.out
@@ -1,4 +1,5 @@
 -- test old extension version entry points
+SET compute_query_id = auto;
 CREATE EXTENSION pg_stat_statements WITH VERSION '1.4';
 -- Execution of pg_stat_statements_reset() is granted only to
 -- superusers in 1.4, so this fails.
diff --git a/contrib/pg_stat_statements/expected/pg_stat_statements.out b/contrib/pg_stat_statements/expected/pg_stat_statements.out
index e0abe34bb6..e8d22f791b 100644
--- a/contrib/pg_stat_statements/expected/pg_stat_statements.out
+++ b/contrib/pg_stat_statements/expected/pg_stat_statements.out
@@ -1,4 +1,5 @@
 CREATE EXTENSION pg_stat_statements;
+SET compute_query_id = auto;
 --
 -- simple and compound statements
 --
diff --git a/contrib/pg_stat_statements/sql/oldextversions.sql b/contrib/pg_stat_statements/sql/oldextversions.sql
index f2e822acd3..773e5f55f9 100644
--- a/contrib/pg_stat_statements/sql/oldextversions.sql
+++ b/contrib/pg_stat_statements/sql/oldextversions.sql
@@ -1,4 +1,5 @@
 -- test old extension version entry points
+SET compute_query_id = auto;
 
 CREATE EXTENSION pg_stat_statements WITH VERSION '1.4';
 -- Execution of pg_stat_statements_reset() is granted only to
diff --git a/contrib/pg_stat_statements/sql/pg_stat_statements.sql b/contrib/pg_stat_statements/sql/pg_stat_statements.sql
index dffd2c8c18..74ced1a7f4 100644
--- a/contrib/pg_stat_statements/sql/pg_stat_statements.sql
+++ b/contrib/pg_stat_statements/sql/pg_stat_statements.sql
@@ -1,4 +1,5 @@
 CREATE EXTENSION pg_stat_statements;
+SET compute_query_id = auto;
 
 --
 -- simple and compound statements

Attachment: signature.asc
Description: PGP signature

Reply via email to