postgres.git / summary / log / commit / refs

commit    dd077ef832e1ec7f5ba2a706152d22647a3b80f5
Author:   Robert Haas <rhaas@postgresql.org>
Date:     Sun Feb 21 08:47:50 2016 +0000
First released in: 9.6.0

    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


contrib/postgres_fdw/postgres_fdw.c | 16 ++++++++-------- 1 file 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: [parent: 902fd1f4e245]