Re: inserting to a multi-table view

Поиск
Список
Период
Сортировка
От Michael Shulman
Тема Re: inserting to a multi-table view
Дата
Msg-id c3f821000806162032t477acfdeqe907340ec70c2bf1@mail.gmail.com
обсуждение исходный текст
Ответ на Re: inserting to a multi-table view  (Craig Ringer <craig@postnewspapers.com.au>)
Ответы Re: inserting to a multi-table view  ("Richard Broersma" <richard.broersma@gmail.com>)
Список pgsql-general
On Mon, Jun 16, 2008 at 10:27 PM, Craig Ringer
<craig@postnewspapers.com.au> wrote:
>> I want to be able to do INSERTs on "studentinfo" and have rows created
>> in both "person" and "student".  This requires first inserting into
>> "person", capturing the "person_id" of the resulting row, and using it
>> to insert into "student".  This seems as though it must be a common
>> situation.
>
> Have you considered using table inheritance to solve this?

No, I don't think table inheritance will help.  My actual situation is
somewhat more complicated: the view takes data from more than two
tables with a many-to-one rather than one-to-one relationship.  For
instance, consider tables "person", "address", and "phone", with a
view "person_with_contact_info" that joins a person with their primary
address and phone number, while inserting to the view should insert a
person along with an address and phone number.  In that case there is
no table that can inherit from the other to solve the problem.

Mike

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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: inserting to a multi-table view
Следующее
От: "Richard Broersma"
Дата:
Сообщение: Re: inserting to a multi-table view