Re: Custom/Foreign-Join-APIs (Re: [v9.5] Custom Plan API)

From: Kouhei Kaigai <kaigai(at)ak(dot)jp(dot)nec(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Thom Brown <thom(at)linux(dot)com>, Shigeru Hanada <shigeru(dot)hanada(at)gmail(dot)com>, "pgsql-hackers(at)postgreSQL(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Custom/Foreign-Join-APIs (Re: [v9.5] Custom Plan API)
Date: 2015-04-24 14:23:29
Message-ID: 9A28C8860F777E439AA12E8AEA7694F8010D5C01@BPXM15GP.gisp.nec.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Wed, Apr 22, 2015 at 10:48 PM, Kouhei Kaigai <kaigai(at)ak(dot)jp(dot)nec(dot)com> wrote:
> >> + else if (scan->scanrelid == 0 &&
> >> + (IsA(scan, ForeignScan) || IsA(scan, CustomScan)))
> >> + varno = INDEX_VAR;
> >>
> >> Suppose scan->scanrelid == 0 but the scan type is something else? Is
> >> that legal? Is varno == 0 the correct outcome in that case?
> >>
> > Right now, no other scan type has capability to return a tuples
> > with flexible type/attributes more than static definition.
> > I think it is a valid restriction that only foreign/custom-scan
> > can have scanrelid == 0.
>
> But the code as you've written it doesn't enforce any such
> restriction. It just spends CPU cycles testing for a condition which,
> to the best of your knowledge, will never happen.
>
> If it's really a can't happen condition, how about checking it via an Assert()?
>
> else if (scan->scanrelid == 0)
> {
> Assert(IsA(scan, ForeignScan) || IsA(scan, CustomScan));
> varno = INDEX_VAR;
> }
>
Thanks for your suggestion. I'd like to use this idea on the next patch.

--
NEC Business Creation Division / PG-Strom Project
KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2015-04-24 14:35:22 Re: a fast bloat measurement tool (was Re: Measuring relation free space)
Previous Message Joel Jacobson 2015-04-24 14:02:18 Re: PL/pgSQL, RAISE and error context