Re: Add PK constraint to a Unique Index via updating system catalogs?

From: CS DBA <cs_dba(at)consistentstate(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Add PK constraint to a Unique Index via updating system catalogs?
Date: 2014-01-10 17:26:38
Message-ID: 52D02D4E.6070605@consistentstate.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Any way to add a PK "under the covers" for PostgreSQL version 8.3?

On 01/06/2014 03:53 PM, Thomas Kellerer wrote:
> CS DBA wrote on 06.01.2014 23:30:
>> We have a few very large tables with unique indexes on a column but
>> the column is not defined as the Primary Key. Can we add a PK
>> constraint via updates to the system catalogs so we can avoid the
>> lengthy checks that would take place if we ran "alter table add
>> constraint primary key...."
>>
>
> You can add a PK constraint with the "USING INDEX" clause:
>
> alter table foo
> add primary key
> using index unique_index_name;
>
>
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Preston Hagar 2014-01-10 17:43:47 Re: Question about memory usage
Previous Message Steve Atkins 2014-01-10 17:09:04 Re: Question about memory usage