Problem with rules and conditions

From: "Tobias Hermansson" <tobhe_nospm(at)hotmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Problem with rules and conditions
Date: 2001-07-13 18:52:14
Message-ID: F227FIMZhzhWQFkPL7y00001e07@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Skvde, Sweden
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2001-07-13 19:18:47 Re: iconv?
Previous Message Peter Eisentraut 2001-07-13 18:22:55 Re: grant and SQL92