Re: Union-ifying RangeTblEntry - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Union-ifying RangeTblEntry
Date
Msg-id 22398.1390923369@sss.pgh.pa.us
Whole thread Raw
In response to Re: Union-ifying RangeTblEntry  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Tue, Jan 28, 2014 at 1:18 AM, Craig Ringer <craig@2ndquadrant.com> wrote:
>> In the process I noticed the comment:
>> 
>> /*
>> * XXX the fields applicable to only some rte kinds should be
>> * merged into a union.  I didn't do this yet because the diffs
>> * would impact a lot of code that is being actively worked on.
>> * FIXME someday.
>> */

> I'd be more inclined to just remove the comment.  Does a RangeTblEntry
> really use enough memory that we need to conserve bytes there?

It doesn't; RTEs aren't that big, and more to the point, there aren't that
many of them per query.  I think I wrote that comment, many years ago,
when memory was more precious ... but even then it was more out of
neatnik-ism than any real need to conserve space.

A bigger consideration is the risk of introducing bugs: how certain are
we that no code ever touches fields that are not supposed to be used for
the current rtekind?  I'm sure not.  Right now, it's safe to assume that
e.g. subquery is NULL if it's not an RTE_SUBQUERY, and I think there
are probably places that depend on that.

And lastly, we'd be touching enough code to make such a change a serious
PITA for back-patching, and for third-party modules.  In return for not
much.

So yeah, let's just drop the comment in favor of a note that irrelevant
fields should be zero/null.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Ioseph Kim
Date:
Subject: Mailing subscription test
Next
From: Christian Kruse
Date:
Subject: Suspicion of a compiler bug in clang: using ternary operator in ereport()