Re: [ADMIN] Recreate primary key without dropping foreign keys?

2012-04-17 Thread Igor Neyman
-Original Message- From: Chris Ernst [mailto:cer...@zvelo.com] Sent: Monday, April 16, 2012 10:55 PM To: pgsql-admin@postgresql.org Subject: Re: Recreate primary key without dropping foreign keys? On 04/16/2012 07:02 PM, amador alvarez wrote: How about deferring the FK's while

Re: [ADMIN] Recreate primary key without dropping foreign keys?

2012-04-17 Thread amador alvarez
Unfortunately I checked out that the deferrable option does not let us drop the PK (postgres8.4) while remaining FK's , I did not try on the constraint as NOT VALID is not supported by postgres8. So unless you have a 9 release or you get a try on a parallel table, you have to follow the

Re: [ADMIN] Recreate primary key without dropping foreign keys?

2012-04-16 Thread Chris Ernst
On 04/15/2012 10:57 PM, Frank Lanitz wrote: On Sun, 15 Apr 2012 18:41:05 -0600 Chris Ernst cer...@zvelo.com wrote: Hi all, In PostgreSQL 9.1.3, I have a few fairly large tables with bloated primary key indexes. I'm trying to replace them using newly created unique indexes as outlined in

Re: [ADMIN] Recreate primary key without dropping foreign keys?

2012-04-16 Thread Frank Lanitz
Am 16.04.2012 10:32, schrieb Chris Ernst: On 04/15/2012 10:57 PM, Frank Lanitz wrote: On Sun, 15 Apr 2012 18:41:05 -0600 Chris Ernst cer...@zvelo.com wrote: Hi all, In PostgreSQL 9.1.3, I have a few fairly large tables with bloated primary key indexes. I'm trying to replace them using

Re: [ADMIN] Recreate primary key without dropping foreign keys?

2012-04-16 Thread Chris Ernst
On 04/16/2012 02:39 AM, Frank Lanitz wrote: Am 16.04.2012 10:32, schrieb Chris Ernst: On 04/15/2012 10:57 PM, Frank Lanitz wrote: On Sun, 15 Apr 2012 18:41:05 -0600 Chris Ernst cer...@zvelo.com wrote: Hi all, In PostgreSQL 9.1.3, I have a few fairly large tables with bloated primary key

Re: [ADMIN] Recreate primary key without dropping foreign keys?

2012-04-16 Thread amador alvarez
How about deferring the FK's while recreating the PK ? or using a temporary parallel table to be pointed by the other tables (FK) and swap it up on the recreation. Cheers, A.A On 04/16/2012 06:54 AM, Chris Ernst wrote: On 04/16/2012 02:39 AM, Frank Lanitz wrote: Am 16.04.2012 10:32, schrieb

Re: [ADMIN] Recreate primary key without dropping foreign keys?

2012-04-16 Thread Chris Ernst
On 04/16/2012 07:02 PM, amador alvarez wrote: How about deferring the FK's while recreating the PK ? or using a temporary parallel table to be pointed by the other tables (FK) and swap it up on the recreation. Hmm.. Interesting. But it appears that you have to declare the foreign key as

Re: [ADMIN] Recreate primary key without dropping foreign keys?

2012-04-15 Thread Frank Lanitz
On Sun, 15 Apr 2012 18:41:05 -0600 Chris Ernst cer...@zvelo.com wrote: Hi all, In PostgreSQL 9.1.3, I have a few fairly large tables with bloated primary key indexes. I'm trying to replace them using newly created unique indexes as outlined in the docs. Something like: CREATE UNIQUE