Problem with rules and conditions

Поиск
Список
Период
Сортировка
От Tobias Hermansson
Тема Problem with rules and conditions
Дата
Msg-id F227FIMZhzhWQFkPL7y00001e07@hotmail.com
обсуждение исходный текст
Ответы Re: Problem with rules and conditions  (Jan Wieck <JanWieck@Yahoo.com>)
Список 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 по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: grant and SQL92
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: iconv?