I've just noticed that there are some severe bugs in the column-aliasing
feature in the presence of dropped columns.  For instance

regression=# create table t1(f1 int, f2 int, f3 int);
CREATE TABLE
regression=# select * from t1 as t(a,b);
 a | b | f3                                -- okay, as expected
---+---+----
(0 rows)

regression=# alter table t1 drop column f2;
ALTER TABLE
regression=# select * from t1 as t(a,b);
 a | f3                                    -- what happened to b?
---+----
(0 rows)

regression=# select b from t1 as t(a,b);
ERROR:  column "........pg.dropped.2........" of relation "t1" does not exist
regression=# 

Of course what's happening there is that the alias b got attached to the
dropped column :-(

I have some fixes that appear to take care of this particular issue but
there's more to do yet --- aliases associated with JOINs over tables
with dropped columns aren't right either.  The changes to deal with that
look sufficiently complex that I don't think it's appropriate to try to
back-patch into 7.4 ... I'm just gonna commit the fixes to HEAD.

			regards, tom lane

Wed, 18 Aug 2004 22:03:00 -0400
Tom Lane <tgl@sss.pgh.pa.us>
More fun with dropped columns