Re: inserting to a multi-table view

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Michael Shulman <shulman(at)mathcamp(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: inserting to a multi-table view
Date: 2008-06-17 03:27:16
Message-ID: 48572F14.2080400@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Michael Shulman 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?

It has some limitations, and I've never seen the need myself, but it
sounds like it might fit your needs.

http://www.postgresql.org/docs/8.3/static/ddl-inherit.html

--
Craig Ringer

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Shulman 2008-06-17 03:32:46 Re: inserting to a multi-table view
Previous Message Scott Marlowe 2008-06-17 03:03:40 Re: inserting to a multi-table view