Skip to content

Commit dd077ef

Browse files
committed
postgres_fdw: Avoid sharing list substructure.
list_concat(list_concat(a, b), c) destructively changes both a and b; to avoid such perils, copy lists of remote_conds before incorporating them into larger lists via list_concat(). Ashutosh Bapat, per a report from Etsuro Fujita
1 parent 902fd1f commit dd077ef

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

contrib/postgres_fdw/postgres_fdw.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3488,30 +3488,30 @@ foreign_join_ok(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype,
34883488
{
34893489
case JOIN_INNER:
34903490
fpinfo->remote_conds = list_concat(fpinfo->remote_conds,
3491-
fpinfo_i->remote_conds);
3491+
list_copy(fpinfo_i->remote_conds));
34923492
fpinfo->remote_conds = list_concat(fpinfo->remote_conds,
3493-
fpinfo_o->remote_conds);
3493+
list_copy(fpinfo_o->remote_conds));
34943494
break;
34953495

34963496
case JOIN_LEFT:
34973497
fpinfo->joinclauses = list_concat(fpinfo->joinclauses,
3498-
fpinfo_i->remote_conds);
3498+
list_copy(fpinfo_i->remote_conds));
34993499
fpinfo->remote_conds = list_concat(fpinfo->remote_conds,
3500-
fpinfo_o->remote_conds);
3500+
list_copy(fpinfo_o->remote_conds));
35013501
break;
35023502

35033503
case JOIN_RIGHT:
35043504
fpinfo->joinclauses = list_concat(fpinfo->joinclauses,
3505-
fpinfo_o->remote_conds);
3505+
list_copy(fpinfo_o->remote_conds));
35063506
fpinfo->remote_conds = list_concat(fpinfo->remote_conds,
3507-
fpinfo_i->remote_conds);
3507+
list_copy(fpinfo_i->remote_conds));
35083508
break;
35093509

35103510
case JOIN_FULL:
35113511
fpinfo->joinclauses = list_concat(fpinfo->joinclauses,
3512-
fpinfo_i->remote_conds);
3512+
list_copy(fpinfo_i->remote_conds));
35133513
fpinfo->joinclauses = list_concat(fpinfo->joinclauses,
3514-
fpinfo_o->remote_conds);
3514+
list_copy(fpinfo_o->remote_conds));
35153515
break;
35163516

35173517
default:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy