On Mon, May 11, 2020 at 2:48 PM Tom Lane <t...@sss.pgh.pa.us> wrote: > > There doesn't seem to be any execution-time > > problem with such a representation, but there might be a planning-time > > problem with building it, > > Possibly. We manage to cope with not-all-alike children now, of course, > but I think it might be true that no one plan node has Vars from > dissimilar children. Even so, the Vars are self-identifying, so it > seems like this ought to be soluble.
If the parent is RTI 1, and the children are RTIs 2..6, what varno/varattno will we use in RTI 1's tlist to represent a column that exists in both RTI 2 and RTI 3 but not in RTI 1, 4, 5, or 6? I suppose the answer is 2 - or 3, but I guess we'd pick the first child as the representative of the class. We surely can't use varno 1, because then there's no varattno that makes any sense. But if we use 2, now we have the tlist for RTI 1 containing expressions with a child's RTI as the varno. I could be wrong, but I think that's going to make setrefs.c throw up and die, and I wouldn't be very surprised if there were a bunch of other things that crashed and burned, too. I think we have quite a bit of code that expects to be able to translate between parent-rel expressions and child-rel expressions, and that's going to be pretty problematic here. Maybe your answer is - let's just fix all that stuff. That could well be right, but my first reaction is to think that it sounds hard. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company