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

Commit83204e1

Browse files
committed
Fix contrib/postgres_fdw to handle multiple join conditions properly.
The previous coding supposed that it could consider just a single joincondition in any one parameterized path for the foreign table. But inreality, the parameterized-path machinery forces all join clauses that are"movable to" the foreign table to be evaluated at that node; includingclauses that we might not consider safe to send across. Such cases wouldresult in an Assert failure in an assert-enabled build, and otherwise insending an unsafe clause to the foreign server, which might result inerrors or silently-wrong answers. A lesser problem was that thecost/rowcount estimates generated for the parameterized path failed toaccount for any additional join quals that get assigned to the scan.To fix, rewrite postgresGetForeignPaths so that it correctly collects allthe movable quals for any one outer relation when generating parameterizedpaths; we'll now generate just one path per outer relation not one per joinqual. Also fix bogus assumptions in postgresGetForeignPlan andestimate_path_cost_size that only safe-to-send join quals will bepresented.Based on complaint from Etsuro Fujita that the path costs were beingmiscalculated, though this is significantly different from his proposedpatch.
1 parent4ea2e2d commit83204e1

File tree

5 files changed

+252
-71
lines changed

5 files changed

+252
-71
lines changed

‎contrib/postgres_fdw/deparse.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,15 @@ static void deparseArrayExpr(ArrayExpr *node, deparse_expr_cxt *context);
134134

135135

136136
/*
137-
* Examine eachrestriction clause inbaserel's baserestrictinfo list,
138-
*and classify them into two groups,which are returned as two lists:
137+
* Examine eachqual clause ininput_conds, and classify them into two groups,
138+
* which are returned as two lists:
139139
*- remote_conds contains expressions that can be evaluated remotely
140140
*- local_conds contains expressions that can't be evaluated remotely
141141
*/
142142
void
143143
classifyConditions(PlannerInfo*root,
144144
RelOptInfo*baserel,
145+
List*input_conds,
145146
List**remote_conds,
146147
List**local_conds)
147148
{
@@ -150,7 +151,7 @@ classifyConditions(PlannerInfo *root,
150151
*remote_conds=NIL;
151152
*local_conds=NIL;
152153

153-
foreach(lc,baserel->baserestrictinfo)
154+
foreach(lc,input_conds)
154155
{
155156
RestrictInfo*ri= (RestrictInfo*)lfirst(lc);
156157

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp