Re: cannot get CREATE TABLE AS to work - Mailing list pgsql-sql

From Peter Eisentraut
Subject Re: cannot get CREATE TABLE AS to work
Date
Msg-id Pine.LNX.4.30.0103091751280.929-100000@peter.localdomain
Whole thread Raw
In response to cannot get CREATE TABLE AS to work  ("Creager, Robert S" <CreagRS@LOUISVILLE.STORTEK.COM>)
List 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@gmx.net       http://yi.org/peter-e/



pgsql-sql by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: cannot get CREATE TABLE AS to work
Next
From: "Josh Berkus"
Date:
Subject: Re: List Concatination