[PGSQL 8.2.x] INSERT+INSERT

Поиск
Список
Период
Сортировка
От Vincenzo Romano
Тема [PGSQL 8.2.x] INSERT+INSERT
Дата
Msg-id 200706211156.05821.vincenzo.romano@gmail.com
обсуждение исходный текст
Ответы Re: [PGSQL 8.2.x] INSERT+INSERT  ("Dawid Kuroczko" <qnex42@gmail.com>)
Список pgsql-general
Hi all.
I'd like to do the following:

insert into t1
  values (
    'atextvalue',(
      insert into t2
        values ( 'somethingelse' )
        returning theserial
    )
  )
;

that is, I first insert data into t2 getting back the newly created
serial values, then i insert this values in another table.
I get an error message:
ERROR:  syntax error at or near "into"
referring to thwe second inner "into".
Is there a way to do this?
The inner insert...returning should be the "expression" to be used in
the outer insert.
My objective is to create an SQL script to load some 20+ million
records and avoiding function calls would save some time.

Thanks in advance.

--
Vincenzo Romano
--
Maybe Computer will never become as intelligent as Humans.
For sure they won't ever become so stupid. [VR-1988]

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

Предыдущее
От: PFC
Дата:
Сообщение: Re: Accent insensitive search
Следующее
От: Bruce McAlister
Дата:
Сообщение: Re: Recovery/Restore and Roll Forward Question.