Adding PK to Existing Table

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Adding PK to Existing Table
Date: 2011-04-01 15:39:09
Message-ID: alpine.LNX.2.00.1104010835470.3160@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In -9.0.3 I used ALTER TABLE to replace a varchar() column with a bigint
column so it can be assigned as the table's primary key. From the 9.0.3
manual I tried various flavors of ALTER TABLE <tablename> ADD CONSTRAINT but
cannot find the proper syntax to create the PK. Do I need to first make the
column UNIQUE, then add a NOT NULL constraint?

Rich

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raghavendra 2011-04-01 15:43:52 Re: Adding PK to Existing Table
Previous Message pasman pasmański 2011-04-01 15:32:33 Convert xmin to format used by txid_current