Re: SQL command Error: "create table ... Like parentTable including defaults"

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Ying Lu <ying_lu(at)cs(dot)concordia(dot)ca>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: SQL command Error: "create table ... Like parentTable including defaults"
Date: 2005-05-27 16:17:22
Message-ID: 20050527161722.GA31451@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, May 27, 2005 at 11:48:39AM -0400, Ying Lu wrote:
>
> 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" ... '

The CREATE TABLE documentation shows that LIKE should be in parentheses:

CREATE TABLE tableName1 (LIKE parentTable INCLUDING DEFAULTS);

http://www.postgresql.org/docs/8.0/interactive/sql-createtable.html

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ben Hane 2005-05-27 17:51:17 Privileged Position
Previous Message Bricklen Anderson 2005-05-27 16:02:29 Re: SQL command Error: "create table ... Like parentTable