From 064bd66a20c6c801fb9e329918491de15ca64a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Tue, 30 Jul 2019 00:00:56 +0000 Subject: [PATCH] Avoid segfault in logging queries --- src/backend/distributed/executor/multi_executor.c | 2 +- src/backend/distributed/planner/deparse_shard_query.c | 1 + src/backend/distributed/shared_library_init.c | 5 ++--- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/backend/distributed/executor/multi_executor.c b/src/backend/distributed/executor/multi_executor.c index 2ec12adc7..066a9aa6c 100644 --- a/src/backend/distributed/executor/multi_executor.c +++ b/src/backend/distributed/executor/multi_executor.c @@ -442,7 +442,7 @@ ExecuteQueryIntoDestReceiver(Query *query, ParamListInfo params, DestReceiver *d /* - * ExecuteIntoDestReceiver plans and executes a query and sends results to the given + * ExecutePlanIntoDestReceiver executes a query plan and sends results to the given * DestReceiver. */ void diff --git a/src/backend/distributed/planner/deparse_shard_query.c b/src/backend/distributed/planner/deparse_shard_query.c index 1f906fb26..68d84a6c6 100644 --- a/src/backend/distributed/planner/deparse_shard_query.c +++ b/src/backend/distributed/planner/deparse_shard_query.c @@ -111,6 +111,7 @@ RebuildQueryStrings(Query *originalQuery, List *taskList) } ereport(DEBUG4, (errmsg("query before rebuilding: %s", + task->queryString == NULL ? "(null)" : ApplyLogRedaction(task->queryString)))); UpdateTaskQueryString(query, relationId, valuesRTE, task); diff --git a/src/backend/distributed/shared_library_init.c b/src/backend/distributed/shared_library_init.c index e4a318f99..3b2084218 100644 --- a/src/backend/distributed/shared_library_init.c +++ b/src/backend/distributed/shared_library_init.c @@ -175,9 +175,8 @@ _PG_init(void) * (thus as the innermost/last running hook) to be able to do our * duties. For simplicity insist that all hooks are previously unused. */ - if (planner_hook != NULL || ProcessUtility_hook != NULL || ExecutorStart_hook != - NULL || - ExecutorRun_hook != NULL) + if (planner_hook != NULL || ProcessUtility_hook != NULL || + ExecutorStart_hook != NULL || ExecutorRun_hook != NULL) { ereport(ERROR, (errmsg("Citus has to be loaded first"), errhint("Place citus at the beginning of "