On 2014-12-09 14:41:46 -0300, Alvaro Herrera wrote: > So I've been updating my very old patch to allow logical and physical > column reordering. Here's a WIP first cut for examination.
Do you have a updated patch that has ripened further? > The first thing where this matters is tuple descriptor expansion in > parse analysis; at this stage, things such as "*" (in "select *") are > turned into a target list, which must be sorted according to attlognum. > To achieve this I added a new routine to tupledescs, > TupleDescGetSortedAttrs() which computes a new Attribute array and > caches it in the TupleDesc for later uses; this array points to the > same elements in the normal attribute list but is order by attlognum. That sounds sane. > Another place that needs tweaking is heapam.c, which must construct a > physical tuple from Datum/nulls arrays (heap_form_tuple). In some cases > the input arrays are sorted in logical column order. I'm not sure that changing heaptuple.c's API (you mean that, not heapam.c, right?) is a good level to tackle this at. I think some function to reorder values/isnull arrays into logical order and reverse might end up being less invasive and actually faster. Greetings, Andres Freund -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers