Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1145931

Browse files
committed
bugfix: don't take parent's plan into account in PartitionFilter
1 parentd807338 commit1145931

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

‎src/nodes_common.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ unpack_runtimeappend_private(RuntimeAppendState *scan_state, CustomScan *cscan)
240240

241241
/* Transform partition ranges into plain array of partition Oids */
242242
Oid*
243-
get_partition_oids(List*ranges,int*n,constPartRelationInfo*prel)
243+
get_partition_oids(List*ranges,int*n,constPartRelationInfo*prel,
244+
boolinclude_parent)
244245
{
245246
ListCell*range_cell;
246247
uint32allocated=INITIAL_ALLOC_NUM;
@@ -250,7 +251,7 @@ get_partition_oids(List *ranges, int *n, const PartRelationInfo *prel)
250251

251252
/* If required, add parent to result */
252253
Assert(INITIAL_ALLOC_NUM >=1);
253-
if (prel->enable_parent)
254+
if (include_parent)
254255
result[used++]=PrelParentRelid(prel);
255256

256257
/* Deal with selected partitions */
@@ -521,7 +522,7 @@ rescan_append_common(CustomScanState *node)
521522
}
522523

523524
/* Get Oids of the required partitions */
524-
parts=get_partition_oids(ranges,&nparts,prel);
525+
parts=get_partition_oids(ranges,&nparts,prel,prel->enable_parent);
525526

526527
/* Select new plans for this run using 'parts' */
527528
if (scan_state->cur_plans)

‎src/nodes_common.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ clear_plan_states(CustomScanState *scan_state)
6060
}
6161
}
6262

63-
Oid*get_partition_oids(List*ranges,int*n,constPartRelationInfo*prel);
63+
Oid*get_partition_oids(List*ranges,int*n,constPartRelationInfo*prel,
64+
boolinclude_parent);
6465

6566
Path*create_append_path_common(PlannerInfo*root,
6667
AppendPath*inner_append,

‎src/partition_filter.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ partition_filter_exec(CustomScanState *node)
199199
old_cxt=MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory);
200200

201201
ranges=walk_expr_tree((Expr*)&state->temp_const,&wcxt)->rangeset;
202-
parts=get_partition_oids(ranges,&nparts,prel);
202+
parts=get_partition_oids(ranges,&nparts,prel, false);
203203

204204
if (nparts>1)
205205
elog(ERROR,"PartitionFilter selected more than one partition");
@@ -222,7 +222,7 @@ partition_filter_exec(CustomScanState *node)
222222
elog(ERROR,
223223
"There is no suitable partition for key '%s'",
224224
datum_to_cstring(state->temp_const.constvalue,
225-
state->temp_const.consttype));
225+
state->temp_const.consttype));
226226
}
227227
else
228228
selected_partid=parts[0];

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp