mirror of https://github.com/citusdata/citus.git
Attempt to fix parameter passing with auto_explain
parent
553d5ba15d
commit
c4b6fb1dd0
|
@ -808,7 +808,11 @@ FetchRemoteExplainFromWorkers(Task *task, ExplainState *es, ParamListInfo params
|
||||||
|
|
||||||
if (params)
|
if (params)
|
||||||
{
|
{
|
||||||
ExtractParametersFromParamList(params, ¶mTypes, ¶mValues, false);
|
/* force evaluation of bound params */
|
||||||
|
params = copyParamList(params);
|
||||||
|
|
||||||
|
ExtractParametersForRemoteExecution(params, ¶mTypes,
|
||||||
|
¶mValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
int sendStatus = SendRemoteCommandParams(connection, explainQuery->data,
|
int sendStatus = SendRemoteCommandParams(connection, explainQuery->data,
|
||||||
|
@ -1585,15 +1589,6 @@ FetchPlanQueryForExplainAnalyze(const char *queryString, ParamListInfo params)
|
||||||
{
|
{
|
||||||
StringInfo fetchQuery = makeStringInfo();
|
StringInfo fetchQuery = makeStringInfo();
|
||||||
|
|
||||||
if (params != NULL)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Add a dummy CTE to ensure all parameters are referenced, such that their
|
|
||||||
* types can be resolved.
|
|
||||||
*/
|
|
||||||
appendStringInfo(fetchQuery, "WITH unused AS (%s) ",
|
|
||||||
ParameterResolutionSubquery(params));
|
|
||||||
}
|
|
||||||
|
|
||||||
appendStringInfoString(fetchQuery,
|
appendStringInfoString(fetchQuery,
|
||||||
"SELECT explain_analyze_output, execution_duration "
|
"SELECT explain_analyze_output, execution_duration "
|
||||||
|
|
|
@ -1168,6 +1168,22 @@ set auto_explain.log_analyze to true;
|
||||||
-- the following should not be locally executed since explain analyze is on
|
-- the following should not be locally executed since explain analyze is on
|
||||||
select * from test_ref_table;
|
select * from test_ref_table;
|
||||||
|
|
||||||
|
CREATE TABLE test_auto_explain.test_params
|
||||||
|
( coll1 int8 NULL,
|
||||||
|
coll2 int4 NOT NULL);
|
||||||
|
|
||||||
|
SELECT create_distributed_table('test_auto_explain.test_params', 'coll1');
|
||||||
|
|
||||||
|
CREATE OR REPLACE PROCEDURE test_auto_explain.test_delete_from(p_coll2 int)
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
AS $$
|
||||||
|
BEGIN
|
||||||
|
DELETE FROM test_auto_explain.test_params
|
||||||
|
WHERE coll2 = p_coll2;
|
||||||
|
END;$$;
|
||||||
|
|
||||||
|
CALL test_auto_explain.test_delete_from(20240401);
|
||||||
|
|
||||||
DROP SCHEMA test_auto_explain CASCADE;
|
DROP SCHEMA test_auto_explain CASCADE;
|
||||||
|
|
||||||
SET client_min_messages TO ERROR;
|
SET client_min_messages TO ERROR;
|
||||||
|
|
Loading…
Reference in New Issue