X-Original-To: pgsql-sql@postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id DCCEF925E62 for ; Thu, 29 May 2003 16:48:32 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 70731-05 for ; Thu, 29 May 2003 16:48:31 -0400 (EDT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by developer.postgresql.org (Postfix) with ESMTP id 0BCE3925E46 for ; Thu, 29 May 2003 16:48:31 -0400 (EDT) Received: from [216.135.165.74] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3077001; Thu, 29 May 2003 13:48:35 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Tiaan Wessels , pgsql-sql@postgresql.org Subject: Re: CREATE TABLES AS looses constraints Date: Thu, 29 May 2003 13:48:01 -0700 User-Agent: KMail/1.4.3 References: <20030529163556.7EBDE925D04@developer.postgresql.org> In-Reply-To: <20030529163556.7EBDE925D04@developer.postgresql.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200305291348.01440.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/558 X-Sequence-Number: 13723 Tiaan, > It seems as if a CREATE TABLES AS does not duplicate the table constraint= s.=20 > How can I enforce this. I need the fastest possible way to make an exact= =20 copy=20 > of a table. This is to support the administrative mechanism in an app whe= re=20 > changes are made to a mirrored copy of a set of tables first and when hap= py,=20 > these are copied to the operational tables. I suggest using pg_dump, on the command line: pg_dump -T some_table my_database > some_table.pgdump; psql -U database_owner my_database_mirror < some_table.pgdump; This will copy triggers and indexes as well. --=20 -Josh Berkus Aglio Database Solutions San Francisco