From: | "Jim" <jhefferon(at)smcvt(dot)edu> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | renaming a table, and its primary key constraint |
Date: | 2005-07-30 21:02:16 |
Message-ID: | 1122757336.943778.181500@g43g2000cwa.googlegroups.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello,
Forgive me if this is a dopey question. I'm running a web app with a
dB that takes me a half hour to regenerate. Instead of closing down
every day, I'd like insert the data into a temp table "stuff_tmp" and
then rename that to the permanent table "stuff", so the application is
not off-line for so long.
The table "stuff_tmp" has a primary key constraint. When I rename the
table, this constraint does not get renamed-- it continues to have the
name "stuff_tmp_pkey"-- and (you guessed it) the next time I run the
script pg complains that it can't make "stuff_tmp" because the
constraint already exists.
That I can see, I can't rename the constraint. Do I have that correct?
So I thought to drop the constraint. That I can see I can't add a
primary key constraint "stuff_pkey". Is that correct?
Can I simulate (sort of) a primary key constraint by adding a UNIQUE
index, and a NOT NULL check? That is, if I add those two, do I lose
anything compared with the original primary key constraint?
Thank you,
Jim
From | Date | Subject | |
---|---|---|---|
Next Message | Brock Williams | 2005-07-30 22:02:11 | FATAL: cache lookup failed for access method 6881280 |
Previous Message | Steve Manes | 2005-07-30 19:31:30 | Re: Tool for database design documentation? |