Re: BUG #15669: Error with unnest in PG 11 (ERROR: 0A000)

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: thibaut(dot)madelaine(at)dalibo(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #15669: Error with unnest in PG 11 (ERROR: 0A000)
Date: 2019-03-05 17:16:10
Message-ID: CAOBaU_Z7fBFSO95RQff+kOALUAbm9eOjpPCx7NgzeziCaD=qyg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Mar 5, 2019 at 5:34 PM Julien Rouhaud <rjuju123(at)gmail(dot)com> wrote:
>
> On Tue, Mar 5, 2019 at 4:39 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >
> > PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> > > In PostgreSQL 10.7 and before, it is possible to run the following query:
> >
> > > thibaut=# WITH test AS ( SELECT array[1,2] AS intarr )
> > > SELECT unnest(intarr) AS lot_id FROM test WHERE false;
> >
> > > In version 11.2, the same query fails:
> > > ERROR: 0A000: set-valued function called in context that cannot accept a set
> >
> > Hmm, that's definitely a bug. It looks like we're forgetting to make
> > a ProjectSet plan node for the unnest() if we realize that the query
> > is a no-op; but I'm not sure why 10.x doesn't have the same issue.
> > Digging ...
>
> It seems to be due to 11cf92f6e2e which bypass adjust_paths_for_srfs()
> in case of dummy rel. I'm not familiar with that this code, but
> attached patch seems to fix the issue without breaking regression
> tests.

I forgot to add a regression test, fixed in v2 with a simplified test case.

Attachment Content-Type Size
fix_srf-v2.diff text/x-patch 2.3 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-03-05 17:28:57 Re: BUG #15669: Error with unnest in PG 11 (ERROR: 0A000)
Previous Message Julien Rouhaud 2019-03-05 16:34:21 Re: BUG #15669: Error with unnest in PG 11 (ERROR: 0A000)