Re: How overcome wait for vacuum full? - Mailing list pgsql-admin

From Geoff Tolley
Subject Re: How overcome wait for vacuum full?
Date
Msg-id 464A45C4.6090607@polimetrix.com
Whole thread Raw
In response to Re: How overcome wait for vacuum full?  (Nick Urbanik <nicku@nicku.org>)
Responses Re: How overcome wait for vacuum full?  ("Joshua D. Drake" <jd@commandprompt.com>)
List 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

pgsql-admin by date:

Previous
From: Nick Urbanik
Date:
Subject: How far does interrupting vacuum full rollback?
Next
From: "Joshua D. Drake"
Date:
Subject: Re: How overcome wait for vacuum full?