More fun with dropped columns

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: More fun with dropped columns
Date: 2004-08-19 02:03:00
Message-ID: 7035.1092880980@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2004-08-19 02:03:57 Re: PGPASSWORD and client tools
Previous Message Andrew Dunstan 2004-08-19 02:02:49 Re: PGPASSWORD and client tools