| От | Tom Lane |
|---|---|
| Тема | Re: inserting references |
| Дата | |
| Msg-id | 5851.1024062207@sss.pgh.pa.us обсуждение |
| Ответ на | Re: inserting references (Martijn van Oosterhout <kleptog@svana.org>) |
| Список | pgsql-general |
Martijn van Oosterhout <kleptog@svana.org> writes:
> On Fri, Jun 14, 2002 at 01:14:08AM -0700, ktt wrote:
>> I have a table, which references
>> values in other 3 tables.
>>
>> I would like to insert values in
>> bananas, oranges and kivi tables
>> and insert their bananas_id,oranges_id,kivi_id,
>> country
>> in fruits table.
> If you're using sequences, just use currval() in the insert statement for
> fruits.
If this is always supposed to happen, why have the client issue insert
commands against fruits at all? Set up ON INSERT triggers on the detail
tables that issue inserts into the summary table. They can get all the
info they need from the "new" record for the detail table.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера