mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
autho_explain: Add GUC to log query parameters
auto_explain.log_parameter_max_length is a new GUC part of the extension, similar to the corresponding core setting, that controls the inclusion of query parameters in the logged explain output. More tests are added to check the behavior of this new parameter: when parameters logged in full (the default of -1), when disabled (value of 0) and when partially truncated (value different than the two others). Author: Dagfinn Ilmari Mannsåker Discussion: https://postgr.es/m/87ee09mohb.fsf@wibble.ilmari.org
This commit is contained in:
@ -972,6 +972,28 @@ ExplainQueryText(ExplainState *es, QueryDesc *queryDesc)
|
||||
ExplainPropertyText("Query Text", queryDesc->sourceText, es);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
Reference in New Issue
Block a user