Search Postgresql Archives

Insert Rule

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux