From: Bricklen Anderson <BAnderson@PresiNET.com>
To: Ying Lu <ying_lu@cs.concordia.ca>
Cc: pgsql-sql@postgresql.org
Subject: Re: SQL command Error: "create table ... Like parentTable
Date: Fri, 27 May 2005 09:02:29 -0700
Message-ID: <42974495.7020503@PresiNET.com> (raw)
In-Reply-To: <42974157.201@cs.concordia.ca>
References: <42974157.201@cs.concordia.ca>
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.
_______________________________
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: BAnderson@PresiNET.com, ying_lu@cs.concordia.ca
Subject: Re: SQL command Error: "create table ... Like parentTable
In-Reply-To: <42974495.7020503@PresiNET.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox