Re: [HACKERS] map_partition_varattnos() and whole-row vars - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] map_partition_varattnos() and whole-row vars
Date
Msg-id 28692.1501269985@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] map_partition_varattnos() and whole-row vars  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: [HACKERS] map_partition_varattnos() and whole-row vars
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> If we're remapping the varattnos, I don't see how we can just pass
> whole-row references through.  I mean, if the partition and the parent
> have different varattnos, then a whole-row attribute for one is a
> different thing from a whole-row attribute for the other; the
> HeapTuple you would need to build in each case is different, based on
> the column order for the relation you're worrying about.

There is longstanding code in the planner to handle this for traditional-
inheritance cases; IIRC what it does is build a ROW() expression that
emits the proper output rowtype regardless of the discrepancies.
Not sure why that's apparently not getting applied for partitioning.

> (Boy, our implementation of DROP COLUMN is painful!  If we really got
> rid of columns when they were dropped we could've avoided this whole
> mess.)

I think the pain arises mostly from the decision to allow partitions
to not all have identical rowtype.  I would have lobbied against that
choice if I'd been paying more attention at the start ... but I wasn't.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: [HACKERS] map_partition_varattnos() and whole-row vars
Next
From: Ashutosh Sharma
Date:
Subject: Re: [HACKERS] pl/perl extension fails on Windows