Re: Calculation of relids (pull_varnos result) for PlaceHolderVars
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Date: 2021-01-20T19:15:14Z
Lists: pgsql-hackers
Attachments
- 0001-full-fix-for-pull_varnos.patch (text/x-diff) patch 0001
- 0002-back-branch-delta.patch (text/x-diff) patch 0002
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: indexcol_is_bool_constant_for_query() build_implied_join_equality() 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
Commits
-
Fix pull_varnos' miscomputation of relids set for a PlaceHolderVar.
- 73fc2e5bab1e 13.2 landed
- 55dc86eca70b 14.0 landed
- 1cce024fd26b 12.6 landed