From: Richard Huxton <dev@archonet.com>
To: Ken Winter <ken@sunward.org>
Cc: PostgreSQL pg-sql list <pgsql-sql@postgresql.org>
Subject: Re: Rule causes baffling error
Date: Mon, 19 Dec 2005 09:08:09 +0000
Message-ID: <43A67879.3050003@archonet.com> (raw)
In-Reply-To: <003801c60284$b404a620$6603a8c0@kenxp>
References: <003801c60284$b404a620$6603a8c0@kenxp>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: dev@archonet.com, ken@sunward.org
Subject: Re: Rule causes baffling error
In-Reply-To: <43A67879.3050003@archonet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox