Re: Define update-rule on view

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: patriq(at)gmx(dot)de (Patrick)
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Define update-rule on view
Date: 2001-11-05 17:53:27
Message-ID: 23027.1004982807@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

patriq(at)gmx(dot)de (Patrick) writes:
> i created a working rule for insert on the view.
> now i want to implement a rule for an update.
> the task is, that an update doesnt "update" the selected entry, it got
> to set test_active to false, and insert a new row with the new data
> and test_active settet to true.

I don't believe you can do that with a rule --- you'll run into a
recursive-rule-application problem. You could do it with a trigger,
but perhaps better is to reconsider your table design. Seems like
it might be better to have two tables, one containing the active
entries and one containing the historical ones.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Johnny Jrgensen 2001-11-05 17:54:33 Re: Function problems redux
Previous Message Doug McNaught 2001-11-05 17:46:40 Re: Referring a table in another database