summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/commands/explain.c22
-rw-r--r--src/include/commands/explain.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 5d1f7089daf..e29c2ae206f 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -973,6 +973,28 @@ ExplainQueryText(ExplainState *es, QueryDesc *queryDesc)
}
/*
+ * ExplainQueryParameters -
+ * add a "Query Parameters" node that describes the parameters of the query
+ *
+ * The caller should have set up the options fields of *es, as well as
+ * initializing the output buffer es->str.
+ *
+ */
+void
+ExplainQueryParameters(ExplainState *es, ParamListInfo params, int maxlen)
+{
+ char *str;
+
+ /* This check is consistent with errdetail_params() */
+ if (params == NULL || params->numParams <= 0 || maxlen == 0)
+ return;
+
+ str = BuildParamLogString(params, NULL, maxlen);
+ if (str && str[0] != '\0')
+ ExplainPropertyText("Query Parameters", str, es);
+}
+
+/*
* report_triggers -
* report execution stats for a single relation's triggers
*/
diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h
index 666977fb1f8..9ebde089aed 100644
--- a/src/include/commands/explain.h
+++ b/src/include/commands/explain.h
@@ -99,6 +99,7 @@ extern void ExplainPrintTriggers(ExplainState *es, QueryDesc *queryDesc);
extern void ExplainPrintJITSummary(ExplainState *es, QueryDesc *queryDesc);
extern void ExplainQueryText(ExplainState *es, QueryDesc *queryDesc);
+extern void ExplainQueryParameters(ExplainState *es, ParamListInfo params, int maxlen);
extern void ExplainBeginOutput(ExplainState *es);
extern void ExplainEndOutput(ExplainState *es);