Re: PlaceHolderVars in pushed down child-join cause error

From: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PlaceHolderVars in pushed down child-join cause error
Date: 2018-02-26 04:05:45
Message-ID: CAFjFpRe6AvU=a9OFNez9CJ4xFL7gFPkpLTTVee5q7t9Ltphq5Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 22, 2018 at 8:36 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Thu, Feb 22, 2018 at 7:41 AM, Ashutosh Bapat
> <ashutosh(dot)bapat(at)enterprisedb(dot)com> wrote:
>> 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.
>
> Committed, but I changed the formatting, because as you had it,
> pgindent would have mangled it. While I was at it, I tweaked the
> wording of the comment a bit.

Thanks.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tsunakawa, Takayuki 2018-02-26 04:06:48 RE: [bug fix] Produce a crash dump before main() on Windows
Previous Message Chapman Flack 2018-02-26 03:22:38 Precision loss casting float to numeric