From: Geoff Tolley <geoff@polimetrix.com>
To: pgsql-admin@postgresql.org
Cc: nicku@nicku.org
Subject: Re: How overcome wait for vacuum full?
Date: Tue, 15 May 2007 16:44:04 -0700
Message-ID: <464A45C4.6090607@polimetrix.com> (raw)
In-Reply-To: <20070515232505.GA16021@nicku.org>
References: <20070515221356.GG5264@nicku.org>
<464A3E24.6060204@polimetrix.com>
<20070515232505.GA16021@nicku.org>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: geoff@polimetrix.com, nicku@nicku.org
Subject: Re: How overcome wait for vacuum full?
In-Reply-To: <464A45C4.6090607@polimetrix.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox