Re: An easy question about creating a primary key - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: An easy question about creating a primary key
Date
Msg-id 20011203111257.H93680-100000@megazone23.bigpanda.com
Whole thread Raw
In response to An easy question about creating a primary key  ("Ligia Pimentel" <lmpimentel@yahoo.com>)
List pgsql-sql
On Thu, 29 Nov 2001, Ligia Pimentel wrote:

> Hello.
>
> I'm using postgres 7.1. I have an easy question...
>
> I want to create a primary key constraint on an existing table. The
> documentation says I can't . Please confirm. If this is true... How can I
> rename the existing table so I can create the new one and copy the data?

I believe that's correct for 7.1 at least.  You can rename tables using
ALTER TABLE (alter table <table> rename to <newtable>).  If the column(s)
are marked not null already, you may be able to just get away with
creating a unique index on the column(s) named "<table>_pkey"



pgsql-sql by date:

Previous
From: "Ligia Pimentel"
Date:
Subject: An easy question about creating a primary key
Next
From: Stephan Szabo
Date:
Subject: Re: persistent connections, AOLserver (Was: maybe Offtopic :