rule question - Mailing list pgsql-cygwin

From Agrawal, Manish
Subject rule question
Date
Msg-id 00A42578900AD411BCFD00A0C978DC9304DC027F@mail.coba.usf.edu
Whole thread Raw
List pgsql-cygwin
Hi,

    This may be an inappropriate question for this list, but I have been
struggling with creating a rule in pgsql that will behave as follows:

    When I update a pledges table, if the pledge_amount is 0, the rule
should delete the row instead of recording the pledge as 0.

    I have created the following rule:

    CREATE RULE pledge_delete_zeros AS ON UPDATE TO pledges
    DELETE FROM pledges WHERE (new.pledge_amount = 0)

    The problem is that whenever I have any 0 pledge, the rule deletes
all rows in the table. Where am I going wrong?

Thanks
Manish
_________________________________
Manish Agrawal
Asstt. Prof., Dept. of ISDS, Univ. of South Florida
4202 E. Fowler Ave., CIS 1040, Tampa, Fl 33620 - 7800
(813)-974-6716 (W) 974-6749 (FAX)
magrawal@coba.usf.edu
______________________________________
I use Openoffice, the simple, free Office Suite for Windows/Linux/Macs that
works with existing documents. http://www.openoffice.org
 


pgsql-cygwin by date:

Previous
From: Nyo Maw
Date:
Subject: unexpected protocol charactor during authentication
Next
From: dominique.dormet@tde.alstom.com
Date:
Subject: Problem installing postgesql/ipc-daemon