Skip site navigation (1) Skip section navigation (2)

BUG #2100: CREATE TABLE AS - may not supply table specification

From: "Robert Bengtsson" <robert(at)fbt(dot)se>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2100: CREATE TABLE AS - may not supply table specification
Date: 2005-12-08 14:10:57
Message-ID: 20051208141057.9EDCDF0B41@svr2.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      2100
Logged by:          Robert Bengtsson
Email address:      robert(at)fbt(dot)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.

Responses

pgsql-bugs by date

Next:From: Seneca CunninghamDate: 2005-12-08 15:07:50
Subject: Re: BUG #2094: AIX: libraries contain the symbol main
Previous:From: TomDate: 2005-12-08 13:07:56
Subject: BUG #2099: too many private dirs ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group