Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 9A7139FB2BE for ; Tue, 6 Feb 2007 18:49:56 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 37254-10 for ; Tue, 6 Feb 2007 18:49:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sapo.pt (relay3.ptmail.sapo.pt [212.55.154.23]) by postgresql.org (Postfix) with SMTP id F1BC59FB1BC for ; Tue, 6 Feb 2007 18:49:51 -0400 (AST) Received: (qmail 29852 invoked from network); 6 Feb 2007 22:49:49 -0000 Received: from unknown (HELO sapo.pt) (10.134.35.155) by relay3 with SMTP; 6 Feb 2007 22:49:49 -0000 Received: (qmail 30744 invoked from network); 6 Feb 2007 22:49:48 -0000 X-AntiVirus: PTMail-AV 0.3-0.88.6 X-Virus-Status: Clean (0.01639 seconds) Received: from unknown (HELO hmv02) (hmv@[82.155.144.45]) (envelope-sender ) by mta5 (qmail-ldap-1.03) with SMTP for ; 6 Feb 2007 22:49:48 -0000 Message-ID: <000c01c74a41$1ce8ffb0$6200a8c0@hmv02> From: =?iso-8859-1?Q?H=E9lder_M._Vieira?= To: References: <45C8FDE6.6050603@autoledgers.com.au> Subject: Re: Removing duplicate rows Date: Tue, 6 Feb 2007 22:49:50 -0000 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.3028 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/58 X-Sequence-Number: 27392 > As the table definitions get updated frequently, I'd like to put in my > script to create the table as a copy of the existing 'real' table. I'm > assuming "create table as" would be what I need to use, but what would I > use as the select sql - i.e. how do I use select to pull the definition of > a table. The create statement allows you to copy a table structure, including or excluding constraints. For inclusion and exclusion effects, please read the manual info related with the 'like' clause of the 'create table' statement. Ex.: create temporary table mytesttable (like mymaintable excluding constraints excluding defaults); Regards, Hélder M. Vieira