Problem with rules and conditions - Mailing list pgsql-hackers

From Tobias Hermansson
Subject Problem with rules and conditions
Date
Msg-id F227FIMZhzhWQFkPL7y00001e07@hotmail.com
Whole thread Raw
Responses Re: Problem with rules and conditions  (Jan Wieck <JanWieck@Yahoo.com>)
List pgsql-hackers
Hello,

I have a problem with rules in postgres, it may be a bug, or maybe I'm doing 
something wrong. I'm running version 7.1.2 on a freebsd 4.3 box.

Here is my table:

CREATE TABLE customer ( cono integer not null, Name varchar, ssn  varchar(10), PRIMARY KEY (cono)
);

Here is the rule:

CREATE RULE constraint_customer_ssn_insert
AS ON INSERT
TO customer
WHERE NOT new.ssn IS NULL
DO INSTEAD
INSERT INTO customer (cono,name) VALUES (new.cono,new.name);

When I execute "insert into customer values (1,'bogus',null);" the result is 
"ERROR:  query rewritten 10 times, may contain cycles" is appeared.

Is this suppose to trigger my rule? The condition is not fullfilled, the ssn 
value is null in the insert query. To me it seems like the where clause is 
skipped somehow...

Can anybody help me find out why?

Thanks,
Tobias Hermansson,
MSc Student,
University of Sk�vde, Sweden
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: grant and SQL92
Next
From: Peter Eisentraut
Date:
Subject: Re: iconv?