From: | Curtis Scheer <Curtis(at)DAYCOS(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Insert Rule |
Date: | 2006-09-01 13:22:44 |
Message-ID: | 031936836C46D611BB1B00508BE7345D04A589E6@gatekeeper.daycos.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I'm trying to prevent any further input of a particular field value via an
insert rule with the following rule.
CREATE OR REPLACE RULE rule_foovalue AS
ON INSERT TO foo
WHERE new.foovalue = 1 DO SELECT fooexception.fooexception
FROM fooexception() fooexception(fooexception);
Basically the stored procedure that it calls raises an exception. The
behavior I wanted\excepted was to call the stored procedure when foovalue =
1 and to execute a regular insert when foovalue <> 1. What its doing is
calling the stored procedure when foovalue = 1, that part works just fine.
However, when I try to insert a record into foo with any other value besides
1 it actually inserts the record but doesn't return the # of rows affected.
Is there something else I need to add to the rule so that it returns the
number of rows affected like normal?
Thanks,
Curtis
From | Date | Subject | |
---|---|---|---|
Next Message | Csaba Nagy | 2006-09-01 13:30:27 | Re: Strange error related to temporary tables |
Previous Message | Roman Neuhauser | 2006-09-01 13:06:32 | Re: Create user or role from inside a function? |