From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Ligia Pimentel <lmpimentel(at)yahoo(dot)com> |
Cc: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: An easy question about creating a primary key |
Date: | 2001-12-03 19:16:14 |
Message-ID: | 20011203111257.H93680-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-odbc 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"
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2001-12-03 19:20:07 | Re: An easy question about creating a primary key |
Previous Message | Tom Lane | 2001-12-03 19:01:30 | Re: Second call for platform testing |
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2001-12-03 19:20:07 | Re: An easy question about creating a primary key |
Previous Message | Dave Page | 2001-12-03 16:36:52 | Re: Win32 ODBC Issue! |
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2001-12-03 19:20:07 | Re: An easy question about creating a primary key |
Previous Message | Josh Berkus | 2001-12-03 19:13:15 | Re: Need help with a college SQL exam question... |