Re: Calculation of relids (pull_varnos result) for PlaceHolderVars

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Calculation of relids (pull_varnos result) for PlaceHolderVars
Date: 2021-01-20 19:15:14
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I wrote:
> ...
> 2. pull_varnos() is not passed the planner "root" data structure,
> so it can't get at the PlaceHolderInfo list. We can change its
> API of course, but that propagates to dozens of places.
> ...
> The 0001 patch attached goes ahead and makes those API changes.
> I think this is perfectly reasonable to do in HEAD, but it most
> likely is an unacceptable API/ABI break for the back branches.
> ...
> A third way is to preserve the existing pull_varnos() API in
> the back branches, changing all the internal calls to use a
> new function that has the additional "root" parameter. This
> seems feasible but I've not attempted to code it yet.

Here's a proposed fix that does it like that. The 0001 patch
is the same as before, and then 0002 is a delta to be applied
only in the back branches. What I did there was install a layer
of macros in the relevant .c files that cause calls that look like
the HEAD versions to be redirected to the "xxx_new" functions.
The idea is to keep the actual code in sync with HEAD, for
readability and to minimize back-patching pain. It could be
argued that this is too cute and the internal references should
just go to the "new" functions in the back branches.

I did not bother to preserve ABI for these two functions:
because I judged it highly unlikely that any extensions are
calling them. If anybody thinks differently, we could hack
those in the same way.

regards, tom lane

Attachment Content-Type Size
0001-full-fix-for-pull_varnos.patch text/x-diff 47.8 KB
0002-back-branch-delta.patch text/x-diff 15.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2021-01-20 19:44:11 Re: strange error reporting
Previous Message Dmitry Dolgov 2021-01-20 19:08:57 Re: [HACKERS] [PATCH] Generic type subscripting