From: | Geoff Tolley <geoff(at)polimetrix(dot)com> |
---|---|
To: | pgsql-admin(at)postgresql(dot)org |
Cc: | nicku(at)nicku(dot)org |
Subject: | Re: How overcome wait for vacuum full? |
Date: | 2007-05-15 23:44:04 |
Message-ID: | 464A45C4.6090607@polimetrix.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Nick Urbanik wrote:
> It seems that PostgreSQL 7.3.8 does not support create table
> table_name like original_table.
>
> Can you suggest a way I can create a duplicate table with the same
> triggers and other stuff that this table has?
>
> What is the most efficient way to copy the data?
Something like:
CREATE TABLE mytable_copy AS SELECT * FROM mytable;
ALTER TABLE mytable RENAME TO mytable_old;
ALTER TABLE mytable_copy RENAME TO mytable;
/*
Now add primary key, indices, foreign keys, triggers, rules, column
defaults to mytable, and you'll probably want to drop the foreign keys at
least from mytable_old. I'm afraid you'll have to sort out manually what
these should be.
*/
7.3.8 is quite seriously old. 7.3.19 is the latest in that tree if you must
stick with it.
HTH,
Geoff
From | Date | Subject | |
---|---|---|---|
Next Message | Joshua D. Drake | 2007-05-16 00:01:52 | Re: How overcome wait for vacuum full? |
Previous Message | Nick Urbanik | 2007-05-15 23:37:28 | How far does interrupting vacuum full rollback? |