stat-statements-regress.patch
text/x-diff
Filename: stat-statements-regress.patch
Type: text/x-diff
Part: 0
Patch
Format: unified
| File | + | − |
|---|---|---|
| doc/src/sgml/config.sgml | 4 | 2 |
| src/backend/commands/explain.c | 7 | 1 |
| src/backend/utils/misc/guc.c | 1 | 0 |
| src/include/utils/queryjumble.h | 2 | 1 |
| src/test/regress/pg_regress.c | 2 | 1 |
diff --git a/src/include/utils/queryjumble.h b/src/include/utils/queryjumble.h
index a4c277269e..c670662db2 100644
--- a/src/include/utils/queryjumble.h
+++ b/src/include/utils/queryjumble.h
@@ -57,7 +57,8 @@ enum ComputeQueryIdType
{
COMPUTE_QUERY_ID_OFF,
COMPUTE_QUERY_ID_ON,
- COMPUTE_QUERY_ID_AUTO
+ COMPUTE_QUERY_ID_AUTO,
+ COMPUTE_QUERY_ID_REGRESS
};
/* GUC parameters */
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index b970997c34..fae3926b42 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -604,7 +604,13 @@ ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into, ExplainState *es,
/* Create textual dump of plan tree */
ExplainPrintPlan(es, queryDesc);
- if (es->verbose && plannedstmt->queryId != UINT64CONST(0))
+ /*
+ * COMPUTE_QUERY_ID_REGRESS means COMPUTE_QUERY_ID_AUTO, but we don't
+ * show it up in any of the EXPLAIN plans to keep stable the results
+ * generated by any regression test suite.
+ */
+ if (es->verbose && plannedstmt->queryId != UINT64CONST(0) &&
+ compute_query_id != COMPUTE_QUERY_ID_REGRESS)
{
/*
* Output the queryid as an int64 rather than a uint64 so we match
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 01f373815e..7438df9109 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -412,6 +412,7 @@ static const struct config_enum_entry backslash_quote_options[] = {
*/
static const struct config_enum_entry compute_query_id_options[] = {
{"auto", COMPUTE_QUERY_ID_AUTO, false},
+ {"regress", COMPUTE_QUERY_ID_REGRESS, false},
{"on", COMPUTE_QUERY_ID_ON, false},
{"off", COMPUTE_QUERY_ID_OFF, false},
{"true", COMPUTE_QUERY_ID_ON, true},
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index e6f71c7582..a4612d9a8a 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 'regress';"
"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/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index d99bf38e67..036e6da680 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -7934,9 +7934,11 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
method is not acceptable. In this case, in-core computation
must be always disabled.
Valid values are <literal>off</literal> (always disabled),
- <literal>on</literal> (always enabled) and <literal>auto</literal>,
+ <literal>on</literal> (always enabled), <literal>auto</literal>,
which lets modules such as <xref linkend="pgstatstatements"/>
- automatically enable it.
+ automatically enable it, and <literal>regress</literal> which
+ has the same effect as <literal>auto</literal>, except that the
+ query identifier is hidden in the <literal>EXPLAIN</literal> output.
The default is <literal>auto</literal>.
</para>
<note>