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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Julien Rouhaud <rjuju123(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, thibaut(dot)madelaine(at)dalibo(dot)com, Robert Haas <robertmhaas(at)gmail(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-06 18:23:49
Message-ID: 2250.1551896629@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Julien Rouhaud <rjuju123(at)gmail(dot)com> writes:
> I agree that the RelOptInfo new flag / IS_DUMMY_REL change solution is
> the best solution. Let's hope there won't be too many extensions
> relying on the old IS_DUMMY_REL() macro.

I concluded that that actually doesn't work very well. The reason that
things are set up the way they are, I now remember, is that if we exclude
all children of an appendrel then what we get is a childless Append path.
With the current data structure, that means the appendrel is automatically
recognized as dummy. If we have a separate flag then we'd have to fix a
fair number of places to also set the flag. I'm afraid we'd miss some,
or even more likely that there'd be extensions that would be silently
broken because that doesn't work the same anymore.

So it's now looking like the right solution is to fix IS_DUMMY_REL to
be able to drill down into the path to see if it's a dummy append with
projection(s) on top. This is also better for back-patching, assuming
that we need to worry about extensions using IS_DUMMY_REL:

(1) if an old extension is loaded into a server with the fix, it won't
recognize these corner cases as dummy, but that's no worse than before.

(2) if a recompiled extension is loaded into a server predating the fix,
it will get a link failure due to is_dummy_rel() not being exported.
That's not ideal but at least it's a pretty obvious failure mode.
With the other approach, this would lead to never recognizing dummy rels,
even in cases that worked before, since the extension would be looking at
probably-zero pad space instead of a correctly populated field. Silent
regressions are not nice.

> I'll work on a new version
> of the patch to implement it. In the meantime I'll add an entry for
> this bug in the next commitfest to make sure we don't miss it.

I've already got a mostly-working patch. It's causing one plan change
in select_parallel that I've not quite figured out the reason for, or
I should say that it's not obvious why the existing code appears to
work...

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-03-06 20:12:15 Re: BUG #15669: Error with unnest in PG 11 (ERROR: 0A000)
Previous Message PG Bug reporting form 2019-03-06 17:28:27 BUG #15673: Stackbuilder SSL error on corporate network that uses SSL interdiction/resigning