Re: Primary key vs unique index

From: Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>
To: rverghese <riyav(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Primary key vs unique index
Date: 2012-07-06 19:25:37
Message-ID: CABwTF4Ub43O5JzsgqDL_RpLz1A+28b4Nn7EWMwv8Vmea=+yJnw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jul 6, 2012 at 2:07 PM, rverghese <riyav(at)hotmail(dot)com> wrote:

> Yes I am using that option for one of my POstgres 9.1 database and it works
> well. But its still an issue with Foreign keys, which you need to drop and
> recreate .

Having to drop and create foriegn keys is a legitimate concern. I am
looking into improving that.

> Also I use Slony for replication and it uses the primary key to
> check repl. So I don't want that to be interrupted by dropping PK and
> recreating PK.
>

If you look closely at that example, DROP and CREATE of the primary key is
being done in one command (and hence one transaction), so anything that
depends this constraint should not be affected except from the fact that
this table will be locked in exclusive mode for the duration of this
operation, which should be very short.

Best regards,
--
Gurjeet Singh
EnterpriseDB Corporation
The Enterprise PostgreSQL Company

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andy Chambers 2012-07-06 20:16:33 Weird "LIKE" behaviour
Previous Message Don Parris 2012-07-06 19:13:25 Tutorial On Connecting LibreOffice to PostgreSQL Available