diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index d046614d76..18cf72db05 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -7680,9 +7680,12 @@ 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 off (always disabled),
- on (always enabled) and auto,
+ on (always enabled), auto,
which lets modules such as
- automatically enable it.
+ automatically enable it, and regress which
+ has the same effect as auto, except that the
+ query identifier is hidden in the EXPLAIN output
+ to facilitate automated regression testing.
The default is auto.
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 81a227d8b8..70551522da 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
+ * the queryid in any of the EXPLAIN plans to keep stable the results
+ * generated by regression test suites.
+ */
+ 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 6652a60ec3..b1d8317aa2 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -409,6 +409,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/include/utils/queryjumble.h b/src/include/utils/queryjumble.h
index 7af6652f3e..af5d999b9c 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 */