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

Commit3fe1b83

Browse files
committed
Merge branch 'master' into picky_nodes
2 parentsb05ee92 +66cd411 commit3fe1b83

File tree

1 file changed

+37
-13
lines changed

1 file changed

+37
-13
lines changed

‎pg_pathman.c

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ static WrapperNode *handle_arrexpr(WalkerContext *wcxt, const ScalarArrayOpExpr
8383
staticvoidchange_varnos_in_restrinct_info(RestrictInfo*rinfo,change_varno_context*context);
8484
staticvoidchange_varnos(Node*node,Oidold_varno,Oidnew_varno);
8585
staticboolchange_varno_walker(Node*node,change_varno_context*context);
86+
staticRestrictInfo*rebuild_restrictinfo(Node*clause,RestrictInfo*old_rinfo);
8687

8788
/* copied from allpaths.h */
8889
staticvoidset_plain_rel_pathlist(PlannerInfo*root,RelOptInfo*rel,RangeTblEntry*rte);
@@ -536,28 +537,38 @@ append_child_relation(PlannerInfo *root, RelOptInfo *rel, Index rti,
536537
boolalwaysTrue;
537538
WrapperNode*wrap= (WrapperNode*)lfirst(lc);
538539
Node*new_clause=wrapper_make_expression(wrap,index,&alwaysTrue);
539-
RestrictInfo*old_rinfo= (RestrictInfo*)lfirst(lc2),
540-
*new_rinfo;
540+
RestrictInfo*old_rinfo= (RestrictInfo*)lfirst(lc2);
541541

542542
if (alwaysTrue)
543543
{
544544
continue;
545545
}
546546
Assert(new_clause);
547547

548-
new_rinfo=make_restrictinfo((Expr*)new_clause,
549-
old_rinfo->is_pushed_down,
550-
old_rinfo->outerjoin_delayed,
551-
old_rinfo->pseudoconstant,
552-
old_rinfo->required_relids,
553-
old_rinfo->outer_relids,
554-
old_rinfo->nullable_relids);
548+
if (and_clause((Node*)new_clause))
549+
{
550+
ListCell*alc;
551+
552+
foreach(alc, ((BoolExpr*)new_clause)->args)
553+
{
554+
Node*arg= (Node*)lfirst(alc);
555+
RestrictInfo*new_rinfo=rebuild_restrictinfo(arg,old_rinfo);
556+
557+
change_varnos((Node*)new_rinfo,rel->relid,childrel->relid);
558+
childrel->baserestrictinfo=lappend(childrel->baserestrictinfo,
559+
new_rinfo);
560+
}
561+
}
562+
else
563+
{
564+
RestrictInfo*new_rinfo=rebuild_restrictinfo(new_clause,old_rinfo);
555565

556-
/* Replace old relids with new ones */
557-
change_varnos((Node*)new_rinfo,rel->relid,childrel->relid);
566+
/* Replace old relids with new ones */
567+
change_varnos((Node*)new_rinfo,rel->relid,childrel->relid);
558568

559-
childrel->baserestrictinfo=lappend(childrel->baserestrictinfo,
560-
(void*)new_rinfo);
569+
childrel->baserestrictinfo=lappend(childrel->baserestrictinfo,
570+
(void*)new_rinfo);
571+
}
561572
}
562573

563574
/* Build an AppendRelInfo for this parent and child */
@@ -571,6 +582,19 @@ append_child_relation(PlannerInfo *root, RelOptInfo *rel, Index rti,
571582
heap_close(newrelation,NoLock);
572583
}
573584

585+
/* Create new restriction based on clause */
586+
staticRestrictInfo*
587+
rebuild_restrictinfo(Node*clause,RestrictInfo*old_rinfo)
588+
{
589+
returnmake_restrictinfo((Expr*)clause,
590+
old_rinfo->is_pushed_down,
591+
old_rinfo->outerjoin_delayed,
592+
old_rinfo->pseudoconstant,
593+
old_rinfo->required_relids,
594+
old_rinfo->outer_relids,
595+
old_rinfo->nullable_relids);
596+
}
597+
574598
/* Convert wrapper into expression for given index */
575599
staticNode*
576600
wrapper_make_expression(WrapperNode*wrap,intindex,bool*alwaysTrue)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp