PlaceHolderVars in pushed down child-join cause error

From: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: PlaceHolderVars in pushed down child-join cause error
Date: 2018-02-22 12:41:36
Message-ID: CAFjFpRf=J_KPOtw+bhZeURYkbizr8ufSaXg6gPEF6DKpgH-t6g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
postgres_fdw isn't expected to push down joins with placeholder vars.
But the check for that in foreign_join_ok() only considers
joinrel->relids. For a child-join relids contains the child relids but
PlaceHolderInfo refers to the top parent's relids. Hence postgres_fdw
tries to push down a child-join with PlaceHolderVars in it and fails
with error "unsupported expression type for deparse: 198". 198 being
T_PlaceHolderVar.

The fix is to use joinrel->top_parent_relids for a child-join.
Attached patch for the same.

--
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company

Attachment Content-Type Size
pgfdw_child_join_phvs.patch text/x-patch 3.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2018-02-22 12:54:45 Re: [HACKERS] SERIALIZABLE with parallel query
Previous Message David Rowley 2018-02-22 12:15:26 Re: [HACKERS] Runtime Partition Pruning