Re: [SQL] recreating table and foreign keys

2002-12-03 Thread Stephan Szabo
On Tue, 3 Dec 2002, Tomasz Myrta wrote: > > You'll probably end up using ALTER TABLE ADD CONSTRAINT to add the > > constraints to the new master_table. It's possible that you might > > be able to hack something with the system tables, but that sounds > > dangerous. Or you can upgrade to 7.3 whi

Re: [SQL] recreating table and foreign keys

2002-12-03 Thread Tomasz Myrta
> You'll probably end up using ALTER TABLE ADD CONSTRAINT to add the > constraints to the new master_table. It's possible that you might > be able to hack something with the system tables, but that sounds > dangerous. Or you can upgrade to 7.3 which lets you run alter table > drop column. :) I

Re: [SQL] recreating table and foreign keys

2002-12-03 Thread Stephan Szabo
On Tue, 3 Dec 2002, Tomasz Myrta wrote: > Hi > I use Postgresql 7.2.2. > Sometimes I have to remove a column from my tables (psql): > 1. alter table master_table rename to x; > 2. \i tables.sql > 3. insert into master_table select f1,f2,... from x > 4. drop table x > > I think, foreign keys refer

[SQL] recreating table and foreign keys

2002-12-03 Thread Tomasz Myrta
Hi I use Postgresql 7.2.2. Sometimes I have to remove a column from my tables (psql): 1. alter table master_table rename to x; 2. \i tables.sql 3. insert into master_table select f1,f2,... from x 4. drop table x I think, foreign keys referring from detail_table(s) to master_table have gone. How t