Re: CREATE TABLE AS... syntax? - Mailing list pgsql-general

From caldodge@fpcc.net
Subject Re: CREATE TABLE AS... syntax?
Date
Msg-id 3AE7990D.397840A8@fpcc.net
Whole thread Raw
In response to CREATE TABLE AS... syntax?  ("Dr. Evil" <drevil@sidereal.kz>)
List pgsql-general
"Dr. Evil" wrote:
>
> I'm trying to use CREATE TABLE AS under 7.03.  There are no
> examples in the guide, so I tried a few things:
>
> CREATE TABLE foo (test INT4) AS SELECT number FROM account;
>
> and
>
> CREATE TABLE foo (test INT4) AS number FROM account;
>
> and both of them give ERROR:  parser: parse error at or near "as".
> Any tips on how to use this?

I think you want:

CREATE TABLE foo AS SELECT number AS test FROM account;

Calvin

--
Calvin Dodge
Certified Linux Bigot (tm)
http://www.caldodge.fpcc.net

pgsql-general by date:

Previous
From: Bryan Field-Elliot
Date:
Subject: How to estimate disk space requirements?
Next
From: will trillich
Date:
Subject: Re: last comma inside "CREATE TABLE ()" statements