Thread: trigger or rule?

trigger or rule?

From
"Ricky"
Date:
hello,

i want to ask a simple question.

i tried to make validation in postgre when data = NULL then data will be
changed into 0
so what should i do? using rule or trigger ?

i already tried using rule :
CREATE RULE synsellingprice_kosongtozero AS ON UPDATE TO synsellingprice DO
UPDATE synsellingprice SET sellingprice = 0 WHERE (synsellingprice.productid
= new.productid); when i tried to update, then error said 1"ERROR:  query
rewritten 100 times, may contain cycles"

pls give me advices

Thanks you very much
Ricky