On 12/9/14 12:41 PM, Alvaro Herrera wrote:
> To recap, this is based on the idea of having three numbers for each
> attribute rather than a single attnum; the first of these is attnum (a
> number that uniquely identifies an attribute since its inception and may
> or may not have any relationship to its storage position and the place
> it expands to through user interaction). The second is attphysnum,
> which indicates where it is stored in the physical structure. The third
> is attlognum, which indicates where it expands in "*", where must its
> values be placed in COPY or VALUES lists, etc --- the logical position
> as the user sees it.
Side idea: Let attnum be the logical number, introduce attphysnum as
the storage position, and add an oid to pg_attribute as the eternal
identifier.
That way you avoid breaking pretty much all user code that looks at
pg_attribute, which will probably do something like ORDER BY attnum.
Also, one could get rid of all sorts of ugly code that works around the
lack of an oid in pg_attribute, such as in the dependency tracking.