cannot get CREATE TABLE AS to work

From: "Creager, Robert S" <CreagRS(at)LOUISVILLE(dot)STORTEK(dot)COM>
To: "'SQL - PGSQL'" <pgsql-sql(at)postgresql(dot)org>
Subject: cannot get CREATE TABLE AS to work
Date: 2001-03-09 16:21:32
Message-ID: 10FE17AD5F7ED31188CE002048406DE8514CDD@lsv-msg06.stortek.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


I'm sure I'm doing something wrong, and I'm hoping someone can show me the
way of things. Running 7.1beta5 on an Ultra 5, Solaris 2.6 w/256Mb mem. If
I remove the AS, the table creates correctly and I can do the INSERT INTO
with the SELECT clause

psql -d tassiv -c "\
create table observationsII ( \
ra float8 not null, \
decl float8 not null, \
mag float8 not null, \
smag float8 not null, \
obs_id serial, \
file_id int4 references files on delete cascade, \
star_id int4 references comp_loc on delete set null default null ) \
AS select o.ra, o.decl, o.mag, o.smag, o.file_id from
observations o"

ERROR: parser: parse error at or near "AS"

And the next question, should this really be taking 3 hours to insert 315446
records? I noticed the disk is basically idle during the few times when I
watched. Would this be because of the index created on obs_id?

time psql -d tassiv -c "insert into observationsII( ra, decl, mag, smag,
file_id ) select ra, decl, mag, smag, file_id from observations"
INSERT 0 315446
0.01u 0.01s 3:13:22.39 0.0%

Robert Creager
Senior Software Engineer
Client Server Library
303.673.2365 V
303.661.5379 F
888.912.4458 P
StorageTek
INFORMATION made POWERFUL

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-03-09 16:25:24 Re: List Concatination
Previous Message Najm Hashmi 2001-03-09 16:18:53 Re: quotes in pl/pgsql 0n variable type text or varchar