David Rowley escribió:
> In this case how does Postgresql know that attnum 3 is the 2nd user column
> in that table? Unless I have misunderstood something then there must be
> some logic in there to skip dropped columns and if so then could it not
> just grab the "attphynum" at that location? then just modify the 1-5 places
> listed above to sort on attlognum?
During parse analysis, those columns obtained from pg_attribute are
transformed to target list entries; they travel through the parser and
executor in that representation, and TupleDescs are constructed from
those lists. Making that works correctly needs some more code than just
sorting on attlognum. There are some other messy parts like handling
composite types when passed to functions, COPY, and some other things I
don't remember. Did you look at the places my patch touches?
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services