| От | Klint Gore |
|---|---|
| Тема | Re: [PERL DBI] Insertiing data across multiple tables |
| Дата | |
| Msg-id | 48891DB2.7080805@une.edu.au обсуждение исходный текст |
| Ответ на | [PERL DBI] Insertiing data across multiple tables ("JD Wong" <asi4man@gmail.com>) |
| Список | pgsql-general |
JD Wong wrote: > Does anybody know how to insert data over multiple tables > transactionally? The relationship is 1:1 with the latter table having > a foreign key constraint. In order to add data to Table2 I need to > know the primary key value of the same record in Table1 before it's > committed, which in this case is a serial integer which of course is > regulated by an implicit index. Have a look at INSERT ... RETURNING. It can feed back the new rows to your application so that you can make your 2nd insert without having to pre/reselect them (assuming your running 8.2+) klint. -- Klint Gore Database Manager Sheep CRC A.G.B.U. University of New England Armidale NSW 2350 Ph: 02 6773 3789 Fax: 02 6773 3266 EMail: kgore4@une.edu.au
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера