| От | PFC |
|---|---|
| Тема | Re: [PGSQL 8.2.x] INSERT+INSERT |
| Дата | |
| Msg-id | op.tubvznxjcigqcu@apollo13 обсуждение исходный текст |
| Ответ на | Re: [PGSQL 8.2.x] INSERT+INSERT (Vincenzo Romano <vincenzo.romano@gmail.com>) |
| Список | pgsql-general |
> I think it would be greatly helpful if the insert...returning could be
> seen as a "select" statement and, thus, being usable in the way I
> have described. I suspect that the insert...returning is actually
> implemented as an inser plus a select.
You can create a function which does the INSERT RETURNING and returns the
result, and use this function in a subsequent INSERT.
You can also write, in plpgsql :
FOR a,b,c IN SELECT ... LOOP
INSERT INTO table1 (...) VALUES (a,b) RETURNING your_id INTO _var;
INSERT INTO table2 (...) VALUES (c , _var );
END LOOP
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера