From 29f5b999518b2bd1ad033b3056c5e5c651b21e55 Mon Sep 17 00:00:00 2001 From: Sait Talha Nisanci Date: Wed, 18 Aug 2021 16:20:12 +0300 Subject: [PATCH] Use empty string instead of NULL for queryString Postgres doesn't accept NULL for queryStrings in explain plans anymore. Internally, there are some places in Postgres where they modified the NULLS to ""(the empty string). So we do the same on citus side. Commit on Postgres: 1111b2668d89bfcb6f502789158b1233ab4217a6 --- src/backend/distributed/planner/multi_explain.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/backend/distributed/planner/multi_explain.c b/src/backend/distributed/planner/multi_explain.c index 084700fa0..0443523e0 100644 --- a/src/backend/distributed/planner/multi_explain.c +++ b/src/backend/distributed/planner/multi_explain.c @@ -251,7 +251,13 @@ NonPushableInsertSelectExplainScan(CustomScanState *node, List *ancestors, /* explain the inner SELECT query */ IntoClause *into = NULL; ParamListInfo params = NULL; - char *queryString = NULL; + + /* + * With PG14, we need to provide a string here, + * for now we put an empty string, which is valid according to postgres. + */ + char *queryString = pstrdup(""); + ExplainOneQuery(queryCopy, 0, into, es, queryString, params, NULL); ExplainCloseGroup("Select Query", "Select Query", false, es); @@ -278,7 +284,11 @@ ExplainSubPlans(DistributedPlan *distributedPlan, ExplainState *es) PlannedStmt *plan = subPlan->plan; IntoClause *into = NULL; ParamListInfo params = NULL; - char *queryString = NULL; + /* + * With PG14, we need to provide a string here, + * for now we put an empty string, which is valid according to postgres. + */ + char *queryString = pstrdup(""); instr_time planduration; #if PG_VERSION_NUM >= PG_VERSION_13