Skip to content

Commit 43fd918

Browse files
committed
Heal segfault in handle_modification_query.
To encounter this, you need to parse utility query after entering planning.
1 parent b530684 commit 43fd918

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/pg_pathman.c

+1
Original file line numberDiff line numberDiff line change
@@ -1965,6 +1965,7 @@ make_inh_translation_list(Relation oldrelation, Relation newrelation,
19651965
/*
19661966
* set_append_rel_pathlist
19671967
* Build access paths for an "append relation"
1968+
* Similar to PG function with the same name.
19681969
*
19691970
* NOTE: this function is 'public' (used in hooks.c)
19701971
*/

src/planner_tree_modification.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ handle_modification_query(Query *parse, transform_query_cxt *context)
516516
{
517517
RangeTblEntry *rte;
518518
Oid child;
519-
Node *quals = parse->jointree->quals;
519+
Node *quals;
520520
Index result_rti = parse->resultRelation;
521521
ParamListInfo params = context->query_params;
522522

@@ -525,6 +525,8 @@ handle_modification_query(Query *parse, transform_query_cxt *context)
525525
parse->commandType != CMD_DELETE))
526526
return;
527527

528+
/* can't set earlier because CMD_UTILITY doesn't have jointree */
529+
quals = parse->jointree->quals;
528530
rte = rt_fetch(result_rti, parse->rtable);
529531

530532
/* Exit if it's ONLY table */

0 commit comments

Comments
 (0)