X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4BDE55288C for ; Fri, 27 May 2005 13:02:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31401-03 for ; Fri, 27 May 2005 16:02:40 +0000 (GMT) Received: from presinet-main.presinet.com (presinet.com [209.53.156.1]) by svr1.postgresql.org (Postfix) with ESMTP id 76BA152893 for ; Fri, 27 May 2005 13:02:36 -0300 (ADT) Received: from [10.10.1.151] (BRICK [10.10.1.151]) by presinet-main.presinet.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2658.3) id K7F6NZY2; Fri, 27 May 2005 08:59:03 -0700 Message-ID: <42974495.7020503@PresiNET.com> Date: Fri, 27 May 2005 09:02:29 -0700 From: Bricklen Anderson User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ying Lu Cc: pgsql-sql@postgresql.org Subject: Re: SQL command Error: "create table ... Like parentTable References: <42974157.201@cs.concordia.ca> In-Reply-To: <42974157.201@cs.concordia.ca> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.02 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200505/231 X-Sequence-Number: 21544 Ying Lu wrote: > Greetings, > > I have a simple question about SQL command : > > create table tableName1 LIKE parentTable INCLUDING defaults ; > > > I was trying to create table "tableName1" with the same structure as > "parentTable" without any data. I got a syntax error: 'syntax error at > or near "like" ... ' > > I guess there must be something wrong with my sql command, could > somebody help? > > Thanks a lot, > Emi I've never used the "LIKE..INCLUDING" clause before so I can't comment on that, but as an alternative, you could try a CTAS: create table tableName1 as select * from parentTable where 1=0; (will not get the rows, just the structure). Cheers, Bricklen -- _______________________________ This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. _______________________________