qr/Query Parameters:/,
"query parameters not logged when disabled, text mode");
+# Query Identifier.
+# Logging enabled.
+$log_contents = query_log(
+ $node,
+ "SELECT * FROM pg_class;",
+ {
+ "auto_explain.log_verbose" => "on",
+ "compute_query_id" => "on"
+ });
+
+like(
+ $log_contents,
+ qr/Query Identifier:/,
+ "query identifier logged with compute_query_id=on, text mode");
+
+# Logging disabled.
+$log_contents = query_log(
+ $node,
+ "SELECT * FROM pg_class;",
+ {
+ "auto_explain.log_verbose" => "on",
+ "compute_query_id" => "regress"
+ });
+
+unlike(
+ $log_contents,
+ qr/Query Identifier:/,
+ "query identifier not logged with compute_query_id=regress, text mode");
+
# JSON format.
$log_contents = query_log(
$node,
/* Create textual dump of plan tree */
ExplainPrintPlan(es, queryDesc);
- /*
- * 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
- * what would be seen in the BIGINT pg_stat_statements.queryid column.
- */
- ExplainPropertyInteger("Query Identifier", NULL, (int64)
- plannedstmt->queryId, es);
- }
-
/* Show buffer usage in planning */
if (bufusage)
{
* don't match the built-in defaults.
*/
ExplainPrintSettings(es);
+
+ /*
+ * 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 && queryDesc->plannedstmt->queryId != UINT64CONST(0) &&
+ compute_query_id != COMPUTE_QUERY_ID_REGRESS)
+ {
+ /*
+ * Output the queryid as an int64 rather than a uint64 so we match
+ * what would be seen in the BIGINT pg_stat_statements.queryid column.
+ */
+ ExplainPropertyInteger("Query Identifier", NULL, (int64)
+ queryDesc->plannedstmt->queryId, es);
+ }
}
/*