cannot get CREATE TABLE AS to work

Поиск
Список
Период
Сортировка
От Creager, Robert S
Тема cannot get CREATE TABLE AS to work
Дата
Msg-id 10FE17AD5F7ED31188CE002048406DE8514CDD@lsv-msg06.stortek.com
обсуждение исходный текст
Ответы Re: cannot get CREATE TABLE AS to work  (Peter Eisentraut <peter_e@gmx.net>)
Re: cannot get CREATE TABLE AS to work  ("Josh Berkus" <josh@agliodbs.com>)
Re: cannot get CREATE TABLE AS to work  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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




В списке pgsql-sql по дате отправления:

Предыдущее
От: Najm Hashmi
Дата:
Сообщение: from PosgreSQL 7.1b3 to 7.0.3
Следующее
От: Tom Lane
Дата:
Сообщение: Re: List Concatination