Lists: | pgsql-general |
---|
From: | "Ed L(dot)" <pgsql(at)bluepolka(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | converting unique index into primary key |
Date: | 2004-12-22 23:57:20 |
Message-ID: | 200412221657.20743.pgsql@bluepolka.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
I need to convert an existing unique index on a very heavily inserted table
into a primary key. Alter table works, but locks the table for too long.
As a hack, can I just set pg_index.indisprimary = 't' and
pg_constraint.contype = 'p' for the appropriate row in each? This is for
7.4.6 and 8.0beta3...
TIA...
Ed
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Ed L(dot)" <pgsql(at)bluepolka(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: converting unique index into primary key |
Date: | 2004-12-23 03:42:15 |
Message-ID: | 23558.1103773335@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
"Ed L." <pgsql(at)bluepolka(dot)net> writes:
> I need to convert an existing unique index on a very heavily inserted table
> into a primary key. Alter table works, but locks the table for too long.
> As a hack, can I just set pg_index.indisprimary = 't' and
> pg_constraint.contype = 'p' for the appropriate row in each? This is for
> 7.4.6 and 8.0beta3...
Don't forget to make the underlying columns notnull, too.
regards, tom lane