From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp> |
Cc: | Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, Thom Brown <thom(at)linux(dot)com>, "pgsql-hackers(at)postgreSQL(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Kouhei Kaigai <kaigai(at)ak(dot)jp(dot)nec(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Shigeru Hanada <shigeru(dot)hanada(at)gmail(dot)com> |
Subject: | Re: postgres_fdw join pushdown (was Re: Custom/Foreign-Join-APIs) |
Date: | 2016-02-08 12:43:21 |
Message-ID: | CA+TgmoZzvSsjKftz5n9m0EALCXNqa8yxmBCoR5JypDVvQ1MuCA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Feb 8, 2016 at 5:45 AM, Etsuro Fujita
<fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> Maybe my explanation was not correct, but I'm saying that the targertlist of
> the above outer_plan should be set to the fdw_scan_tlist, to avoid
> misbehavior.
Yeah, I think you're right. So in this hunk:
+ if (foreignrel->reloptkind == RELOPT_JOINREL)
+ {
+ /* For a join relation, get the conditions from
fdw_private structure */
+ remote_conds = fpinfo->remote_conds;
+ local_exprs = fpinfo->local_conds;
+
+ /* Build the list of columns to be fetched from the
foreign server. */
+ fdw_scan_tlist = build_tlist_to_deparse(foreignrel);
+ }
I think we should also be doing outer_plan->targetlist =
fdw_scan_tlist in this block, with a comment like "Ensure that the
outer plan produces the a tuple whose descriptor matches our scan
tuple slot. This is safe because all scans and joins support
projection, so we never need to insert a Result node." It would
probably be good to Assert(outer_plan != NULL) before doing the
assignment, too, just as a guard against future bugs.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2016-02-08 12:52:58 | Re: proposal: make NOTIFY list de-duplication optional |
Previous Message | Pavel Stehule | 2016-02-08 12:41:54 | Re: proposal: schema PL session variables |