Re: BUG #4650: can't specify table schema in CREATE TABLE AS

From: Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>
To: Thue Janus Kristensen <thuejk(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4650: can't specify table schema in CREATE TABLE AS
Date: 2009-02-12 13:49:39
Message-ID: 65937bea0902120549x67f38a1axe540f9cd3c6ce49d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Feb 12, 2009 at 6:22 PM, Thue Janus Kristensen <thuejk(at)gmail(dot)com>wrote:

>
> The following bug has been logged online:
>
> Bug reference: 4650
> Logged by: Thue Janus Kristensen
> Email address: thuejk(at)gmail(dot)com
> PostgreSQL version: 8.3.5
> Operating system: Linux
> Description: can't specify table schema in CREATE TABLE AS
> Details:
>
> According to
> http://www.postgresql.org/docs/8.3/interactive/sql-createtableas.html ,
> the
> following should work:
>
> CREATE TABLE test(a INT) AS (SELECT 1);
>
> However:
>
> k3_dev_tjk=> CREATE TABLE test(a INT) AS (SELECT 1);
> ERROR: syntax error at or near "AS"
> LINE 1: CREATE TABLE test(a INT) AS (SELECT 1);
>
> It works if I drop the table schema:
>
> k3_dev_tjk=> CREATE TABLE test AS (SELECT 1);
> SELECT
>

Look closely, it says just column names, not their datatypes. So the command
should be:

CREATE TABLE test(a) AS (SELECT 1);

Best regards,
--
gurjeet[(dot)singh](at)EnterpriseDB(dot)com
singh(dot)gurjeet(at){ gmail | hotmail | indiatimes | yahoo }.com

EnterpriseDB http://www.enterprisedb.com

Mail sent from my BlackLaptop device

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Heikki Linnakangas 2009-02-12 15:45:53 Re: BUG #4648: needless deadlock on tables having foreign-key
Previous Message Konstantin 2009-02-12 13:24:30 Re: BUG #4648: needless deadlock on tables having foreign-key