Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id E8682B5DBDC for ; Thu, 25 Aug 2011 07:44:27 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 31360-07 for ; Thu, 25 Aug 2011 10:44:19 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx01.bfk.de (mx01.bfk.de [193.227.124.2]) by mail.postgresql.org (Postfix) with ESMTP id EE5ABB5DBC4 for ; Thu, 25 Aug 2011 07:44:18 -0300 (ADT) Received: from mx00.int.bfk.de ([10.119.110.2]) by mx01.bfk.de with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) id 1QwXQ1-0005jn-1F; Thu, 25 Aug 2011 10:44:17 +0000 Received: by bfk.de with local id 1QwXQ0-0000fa-Ue; Thu, 25 Aug 2011 10:44:16 +0000 From: Florian Weimer To: Julien Cigar Cc: pgsql-sql@postgresql.org Subject: Re: new table with a select References: <20110825104435.68556k0yyck63vr7@mail.sapo.pt> <4E561A6A.60807@ulb.ac.be> Date: Thu, 25 Aug 2011 10:44:16 +0000 In-Reply-To: <4E561A6A.60807@ulb.ac.be> (Julien Cigar's message of "Thu, 25 Aug 2011 11:48:26 +0200") Message-ID: <821uw993en.fsf@mid.bfk.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.432 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.532 X-Spam-Level: X-Archive-Number: 201108/103 X-Sequence-Number: 35771 * Julien Cigar: > create table foo as select * from bar; > > just add "where 1=3D2" if you just want the schema There's also this: CREATE TABLE foo (LIKE bar); This gives you more control over what aspects of the table are duplicated; see the documentation for details. --=20 Florian Weimer BFK edv-consulting GmbH http://www.bfk.de/ Kriegsstra=DFe 100 tel: +49-721-96201-1 D-76133 Karlsruhe fax: +49-721-96201-99