Re: inserting references

Поиск
Список
Период
Сортировка
От 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 по дате отправления:

Предыдущее
От: "Cornelia Boenigk"
Дата:
Сообщение: Re: read this and puke
Следующее
От: Tom Lane
Дата:
Сообщение: Re: read this and puke