Inoue san,

> This style of "DROP COLUMN" would change the attribute
> numbers whose positons are after the dropped column.
> Unfortunately we have no mechanism to invalidate/remove
> objects(or prepared plans) which uses such attribute numbers.

1 create table alpha( id int4, payload text );
2 insert into alpha( id, payload ) values( 0, 'zero' );
3 create table t( payload text );
4 insert into t( payload ) select payload from alpha;
5 drop table alpha;
6 alter table t rename to alpha;

 Not  a   big  deal,   right?  Also,  drop   column  isn't   really  needed
that  often  and   requires  alot  of  manual   processing,  like  updating
views/rules/procedures etc.
 On the  other hand, when dropping  a column (multiple columns)  in a table
with  10+ columns,  statements 3  and 4  above may  become quite  painfull.
It'd  be  nice  if  drop  column were  `expanded'  to  appropriate  queries
automatically.  Not sure  about  abovementioned attribute  numbers in  such
case.
 In general, however,  if drop column is the only  statement that is likely
to affect attribute numbers this way  (assuming that add column always adds
and never inserts an attribute), then  a fairly simple function in plpgsql,
shipped with template1 will probably do. At  least it should work to drop a
single column, because full-featured function will require argument list of
variable length.

 Ed



---
 Well I tried to be meek
  And I have tried to be mild
 But I spat like a woman
  And I sulked like a child
 I have lived behind the walls
  That have made me alone
 Striven for peace
  Which I never have known

 Dire Straits, Brothers In Arms, The Man's Too Strong (Knopfler)

Reply via email to