Re: Rule causes baffling error

From: Richard Huxton <dev(at)archonet(dot)com>
To: Ken Winter <ken(at)sunward(dot)org>
Cc: 'PostgreSQL pg-sql list' <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Rule causes baffling error
Date: 2005-12-19 09:08:09
Message-ID: 43A67879.3050003@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Ken Winter wrote:
> This rule is supposed to (1) cause an update directed to the view
> "my_data_now" to be made to the underlying table "my_data", (2) reset the
> "effective_date_and_time" of that row to 'now', (3) insert a record
> containing the old values into "my_data", and (4) expire that "old" record
> by setting its "expiration_date_and_time" to 'now'.

I think you want a trigger rather than a rule.

Rules rewrite the query structure, triggers let you deal with values on
a row-by-row basis (for row-level triggers).

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Lane Van Ingen 2005-12-19 13:07:20 How to Force Transactions to Process Serially on A Table
Previous Message Matthew Smith 2005-12-19 05:57:48 Help on a complex query (avg data for day of the week)