Re: cannot get CREATE TABLE AS to work

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: "Creager, Robert S" <CreagRS(at)LOUISVILLE(dot)STORTEK(dot)COM>
Cc: "'SQL - PGSQL'" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: cannot get CREATE TABLE AS to work
Date: 2001-03-09 16:52:30
Message-ID: Pine.LNX.4.30.0103091751280.929-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Creager, Robert S writes:

> 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"

Either you have an AS clause, or a column list, not both.

> 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?

Quite likely. Also make sure you wrap the inserts into a BEGIN/COMMIT
block.

--
Peter Eisentraut peter_e(at)gmx(dot)net http://yi.org/peter-e/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2001-03-09 16:56:35 Re: cannot get CREATE TABLE AS to work
Previous Message Josh Berkus 2001-03-09 16:49:08 Re: cannot get CREATE TABLE AS to work