Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 544759FBF90 for ; Tue, 15 May 2007 20:44:11 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 20501-07 for ; Tue, 15 May 2007 20:44:02 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mail.polimetrix.com (mail.polimetrix.com [209.128.109.230]) by postgresql.org (Postfix) with ESMTP id 1CED49FBFD9 for ; Tue, 15 May 2007 20:44:06 -0300 (ADT) Received: from [10.1.1.201] ([10.1.1.201]) by mail.polimetrix.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.1830); Tue, 15 May 2007 16:44:05 -0700 Message-ID: <464A45C4.6090607@polimetrix.com> Date: Tue, 15 May 2007 16:44:04 -0700 From: Geoff Tolley User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.10) Gecko/20070226 CentOS/1.0.8-0.2.el4.centos SeaMonkey/1.0.8 MIME-Version: 1.0 To: pgsql-admin@postgresql.org CC: nicku@nicku.org Subject: Re: How overcome wait for vacuum full? References: <20070515221356.GG5264@nicku.org> <464A3E24.6060204@polimetrix.com> <20070515232505.GA16021@nicku.org> In-Reply-To: <20070515232505.GA16021@nicku.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 15 May 2007 23:44:05.0403 (UTC) FILETIME=[EC784EB0:01C7974A] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/127 X-Sequence-Number: 25447 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