From: Tom Lane <tgl@sss.pgh.pa.us>
To: Julien Rouhaud <rjuju123@gmail.com>
Cc: thibaut.madelaine@dalibo.com, Robert Haas <robertmhaas@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #15669: Error with unnest in PG 11 (ERROR: 0A000)
Date: Tue, 05 Mar 2019 12:28:57 -0500
Message-ID: <21482.1551806937@sss.pgh.pa.us> (raw)
In-Reply-To: <CAOBaU_YPJj95_9oskbobWxinOmfu3zJrNAnFD77yuzFTb6tmbA@mail.gmail.com>
References: <15669-02fb3296cca26203@postgresql.org>
<19353.1551800347@sss.pgh.pa.us>
<CAOBaU_YPJj95_9oskbobWxinOmfu3zJrNAnFD77yuzFTb6tmbA@mail.gmail.com>
Julien Rouhaud <rjuju123@gmail.com> writes:
> On Tue, Mar 5, 2019 at 4:39 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> 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.
Hm, yeah, that function is definitely a few bricks shy of a load.
The amount of code it's bypassing for the dummy-rel case is pretty
scary. While it doesn't look like anything except the SRF case is
actively broken, there's a lot of room there for somebody to insert
new code and not notice that they need to fix the dummy-rel path
as well. Having to duplicate the adjust_paths_for_srfs call doesn't
bode well for the future.
I'm inclined to fix it by not having the early-return path, but rather
if (is_dummy_rel)
{
// minimum possible amount of code here
}
else
{
// minimum possible amount of code here, too
}
// maximum possible amount of code here
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, rjuju123@gmail.com, robertmhaas@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15669: Error with unnest in PG 11 (ERROR: 0A000)
In-Reply-To: <21482.1551806937@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox