rules on INSERT can't UPDATE new instance?

From: Louis-David Mitterrand <cunctator(at)apartia(dot)ch>
To: pgsql-general(at)hub(dot)org
Subject: rules on INSERT can't UPDATE new instance?
Date: 2000-05-20 09:00:56
Message-ID: 20000520110056.A3592@styx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers


From the create_rule man page this example is offered:

CREATE RULE example_5 AS
ON INERT TO emp WHERE new.salary > 5000
DO
UPDATE NEWSET SET salary = 5000;

But what is "NEWSET"? Is it a keyword?

My problem is that on an insert with an invalid amount I try to perform
an update with a corrected amount, but the action part of the rule
doesn't affect or "see" the newly inserted row (or so it seems).

I tried: CREATE RULE ON INSERT TO bid WHERE new.price > limit
DO UPDATE bid SET price = 0.1;

and all price columns in the bid table would be set to 0.1 _except_ the
newly inserted row.

Am I missing something obvious?

TIA

--
Louis-David Mitterrand - ldm(at)apartia(dot)org - http://www.apartia.fr

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris 2000-05-20 09:17:06 Re: [HACKERS] Postgresql OO Patch
Previous Message Chris 2000-05-20 08:41:28 Re: OO Patch

Browse pgsql-hackers by date

  From Date Subject
Next Message Chris 2000-05-20 09:17:06 Re: [HACKERS] Postgresql OO Patch
Previous Message Chris 2000-05-20 08:48:47 Re: OO / fe-be protocol