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.