diff options
author | Robert Haas <rhaas@postgresql.org> | 2016-02-21 14:17:50 +0530 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2016-02-21 14:17:50 +0530 |
commit | dd077ef832e1ec7f5ba2a706152d22647a3b80f5 (patch) | |
tree | 6c883fa2fa2f4928b0128e681cd7ac1da28f7e87 /contrib/postgres_fdw/postgres_fdw.c | |
parent | 902fd1f4e2457f6f04a988920491fffb90028035 (diff) | |
download | postgresql-dd077ef832e1ec7f5ba2a706152d22647a3b80f5.tar.gz postgresql-dd077ef832e1ec7f5ba2a706152d22647a3b80f5.zip |
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
Diffstat (limited to 'contrib/postgres_fdw/postgres_fdw.c')
-rw-r--r-- | contrib/postgres_fdw/postgres_fdw.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c index 465f43cd7c9..d79e4ccbe3d 100644 --- a/contrib/postgres_fdw/postgres_fdw.c +++ b/contrib/postgres_fdw/postgres_fdw.c @@ -3488,30 +3488,30 @@ foreign_join_ok(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, { case JOIN_INNER: fpinfo->remote_conds = list_concat(fpinfo->remote_conds, - fpinfo_i->remote_conds); + list_copy(fpinfo_i->remote_conds)); fpinfo->remote_conds = list_concat(fpinfo->remote_conds, - fpinfo_o->remote_conds); + list_copy(fpinfo_o->remote_conds)); break; case JOIN_LEFT: fpinfo->joinclauses = list_concat(fpinfo->joinclauses, - fpinfo_i->remote_conds); + list_copy(fpinfo_i->remote_conds)); fpinfo->remote_conds = list_concat(fpinfo->remote_conds, - fpinfo_o->remote_conds); + list_copy(fpinfo_o->remote_conds)); break; case JOIN_RIGHT: fpinfo->joinclauses = list_concat(fpinfo->joinclauses, - fpinfo_o->remote_conds); + list_copy(fpinfo_o->remote_conds)); fpinfo->remote_conds = list_concat(fpinfo->remote_conds, - fpinfo_i->remote_conds); + list_copy(fpinfo_i->remote_conds)); break; case JOIN_FULL: fpinfo->joinclauses = list_concat(fpinfo->joinclauses, - fpinfo_i->remote_conds); + list_copy(fpinfo_i->remote_conds)); fpinfo->joinclauses = list_concat(fpinfo->joinclauses, - fpinfo_o->remote_conds); + list_copy(fpinfo_o->remote_conds)); break; default: |