Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitebf6c52

Browse files
committed
Add compute_query_id = regress
"regress" is a new mode added to compute_query_id aimed at facilitatingregression testing when a module computing query IDs is loaded into thebackend, like pg_stat_statements. It works the same way as "auto",meaning that query IDs are computed if a module enables it, except thatquery IDs are hidden in EXPLAIN outputs to ensure regression outputstability.Like any GUCs of the kind (force_parallel_mode, etc.), this newconfiguration can be added to an instance's postgresql.conf, or justpassed down with PGOPTIONS at command level. compute_query_id uses anenum for its set of option values, meaning that this addition ensuresABI compatibility.Using this new configuration mode allows installcheck-world to pass whenrunning the tests on an instance with pg_stat_statements enabled,stabilizing the test output while checking the paths doing query IDcomputations.Reported-by: Anton MelnikovReviewed-by: Julien RouhaudDiscussion:https://postgr.es/m/1634283396.372373993@f75.i.mail.ruDiscussion:https://postgr.es/m/YgHlxgc/OimuPYhH@paquier.xyzBackpatch-through: 14
1 parent8810356 commitebf6c52

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

‎doc/src/sgml/config.sgml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7934,9 +7934,12 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
79347934
method is not acceptable. In this case, in-core computation
79357935
must be always disabled.
79367936
Valid values are <literal>off</literal> (always disabled),
7937-
<literal>on</literal> (always enabled) and <literal>auto</literal>,
7937+
<literal>on</literal> (always enabled), <literal>auto</literal>,
79387938
which lets modules such as <xref linkend="pgstatstatements"/>
7939-
automatically enable it.
7939+
automatically enable it, and <literal>regress</literal> which
7940+
has the same effect as <literal>auto</literal>, except that the
7941+
query identifier is hidden in the <literal>EXPLAIN</literal> output
7942+
to facilitate automated regression testing.
79407943
The default is <literal>auto</literal>.
79417944
</para>
79427945
<note>

‎src/backend/commands/explain.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,13 @@ ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into, ExplainState *es,
604604
/* Create textual dump of plan tree */
605605
ExplainPrintPlan(es,queryDesc);
606606

607-
if (es->verbose&&plannedstmt->queryId!=UINT64CONST(0))
607+
/*
608+
* COMPUTE_QUERY_ID_REGRESS means COMPUTE_QUERY_ID_AUTO, but we don't show
609+
* the queryid in any of the EXPLAIN plans to keep stable the results
610+
* generated by regression test suites.
611+
*/
612+
if (es->verbose&&plannedstmt->queryId!=UINT64CONST(0)&&
613+
compute_query_id!=COMPUTE_QUERY_ID_REGRESS)
608614
{
609615
/*
610616
* Output the queryid as an int64 rather than a uint64 so we match

‎src/backend/utils/misc/guc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ static const struct config_enum_entry backslash_quote_options[] = {
414414
*/
415415
staticconststructconfig_enum_entrycompute_query_id_options[]= {
416416
{"auto",COMPUTE_QUERY_ID_AUTO, false},
417+
{"regress",COMPUTE_QUERY_ID_REGRESS, false},
417418
{"on",COMPUTE_QUERY_ID_ON, false},
418419
{"off",COMPUTE_QUERY_ID_OFF, false},
419420
{"true",COMPUTE_QUERY_ID_ON, true},

‎src/include/utils/queryjumble.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ enum ComputeQueryIdType
5757
{
5858
COMPUTE_QUERY_ID_OFF,
5959
COMPUTE_QUERY_ID_ON,
60-
COMPUTE_QUERY_ID_AUTO
60+
COMPUTE_QUERY_ID_AUTO,
61+
COMPUTE_QUERY_ID_REGRESS
6162
};
6263

6364
/* GUC parameters */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp