Re: inserting to a multi-table view

From: "Michael Shulman" <shulman(at)mathcamp(dot)org>
To: Philippe Grégoire <philippe(dot)gregoire(at)boreal-is(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: inserting to a multi-table view
Date: 2008-06-17 15:15:23
Message-ID: c3f821000806170815n6ce02e8ctc0e0b173e678cdf9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jun 17, 2008 at 7:56 AM, Philippe Grégoire
<philippe(dot)gregoire(at)boreal-is(dot)com> wrote:
> CREATE RULE studentinro_insert AS ON INSERT TO studentinfo
> DO INSTEAD
> (
> INSERT INTO person ...;
> INSERT INTO student(person_id,...) VALUES
> (currval('person_person_id_seq'),...);
> );

I initially thought of this, but discounted it because if the original
insert query tried to set person_id directly (instead of getting it from
the default sequence) the supplied value would have to be discarded. I
have any plans to do anything of the sort, though, and I suppose the user
has little right to expect to be able to do such a thing safely anyway.
So perhaps this is the simplest solution; thanks.

Mike

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Shulman 2008-06-17 15:34:58 Re: inserting to a multi-table view
Previous Message Michael Shulman 2008-06-17 14:58:45 Re: inserting to a multi-table view