BUG #2100: CREATE TABLE AS - may not supply table specification - Mailing list pgsql-bugs

From Robert Bengtsson
Subject BUG #2100: CREATE TABLE AS - may not supply table specification
Date
Msg-id 20051208141057.9EDCDF0B41@svr2.postgresql.org
Whole thread Raw
Responses Re: BUG #2100: CREATE TABLE AS - may not supply table specification
Re: BUG #2100: CREATE TABLE AS - may not supply table specification
List pgsql-bugs
The following bug has been logged online:

Bug reference:      2100
Logged by:          Robert Bengtsson
Email address:      robert@fbt.se
PostgreSQL version: PostgreSQL Data
Operating system:   Windows Server 2003, Web Edition
Description:        CREATE TABLE AS - may not supply table specification
Details:

CREATE TABLE AS seems to be broken.

The following syntax works:

CREATE TABLE l_modeltext WITHOUT OIDS AS (SELECT distinct modeltext as text,
make, model, make_id, model_id from l_modelcode);

while the following generates an error:

CREATE TABLE l_modeltext
(
  id serial NOT NULL,
  text varchar(60),
  make varchar(30),
  model varchar(30),
  make_id int4,
  model_id int4
) WITHOUT OIDS AS (SELECT distinct modeltext as text, make, model, make_id,
model_id from l_modelcode);

with the following errorcode:

ERROR:  syntax error at or near "AS" at character 94

However, the errorcode is, strangely enough, somewhat dependent on where the
edit-cursor is placed inside pgAdmin.

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Fwd: Bug#338645: postgresql-contrib-8.1: dbf2pg silently
Next
From: Tom.Zschockelt@flender.com
Date:
Subject: Re: BUG #2099: too many private dirs ?