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

Commit0c8cd7f

Browse files
committed
attempt to fix duplicate rows (issue#155)
1 parent7a56126 commit0c8cd7f

File tree

2 files changed

+11
-17
lines changed

2 files changed

+11
-17
lines changed

‎src/hooks.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ pathman_rel_pathlist_hook(PlannerInfo *root,
369369
* FROM test.tmp2 t2
370370
* WHERE id = t.id);
371371
*
372+
* or unions, multilevel partitioning, etc.
373+
*
372374
* Since we disable optimizations on 9.5, we
373375
* have to skip parent table that has already
374376
* been expanded by standard inheritance.
@@ -378,23 +380,18 @@ pathman_rel_pathlist_hook(PlannerInfo *root,
378380
foreach (lc,root->append_rel_list)
379381
{
380382
AppendRelInfo*appinfo= (AppendRelInfo*)lfirst(lc);
381-
RangeTblEntry*cur_parent_rte,
382-
*cur_child_rte;
383-
384-
/* This 'appinfo' is not for this child */
385-
if (appinfo->child_relid!=rti)
386-
continue;
387-
388-
cur_parent_rte=root->simple_rte_array[appinfo->parent_relid];
389-
cur_child_rte=rte;/* we already have it, saves time */
390383

391-
/* This child == its own parent table! */
392-
if (cur_parent_rte->relid==cur_child_rte->relid)
384+
/*
385+
* If there's an 'appinfo', it means that somebody
386+
* (PG?) has already processed this partitioned table
387+
* and added its children to the plan.
388+
*/
389+
if (appinfo->child_relid==rti)
393390
return;
394391
}
395392
}
396393

397-
/* Make copy of partitioning expression and fix Var'svarno attributes */
394+
/* Make copy of partitioning expression and fix Var's varno attributes */
398395
part_expr=PrelExpressionForRelid(prel,rti);
399396

400397
/* Get partitioning-related clauses (do this before append_child_relation()) */

‎src/planner_tree_modification.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,7 @@ disable_standard_inheritance(Query *parse, transform_query_cxt *context)
343343
/* Proceed if table is partitioned by pg_pathman */
344344
if ((prel=get_pathman_relation_info(rte->relid))!=NULL)
345345
{
346-
/*
347-
* HACK: unset the 'inh' flag to disable standard
348-
* planning. We'll set it again later.
349-
*/
346+
/* HACK: unset the 'inh' flag to disable standard planning */
350347
rte->inh= false;
351348

352349
/* Try marking it using PARENTHOOD_ALLOWED */
@@ -569,7 +566,7 @@ partition_filter_visitor(Plan *plan, void *context)
569566
void
570567
assign_rel_parenthood_status(RangeTblEntry*rte,
571568
rel_parenthood_statusnew_status)
572-
{
569+
{
573570
Assert(rte->rtekind!=RTE_CTE);
574571

575572
/* HACK: set relevant bits in RTE */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp