rule question

From: "Agrawal, Manish" <MAgrawal(at)coba(dot)usf(dot)edu>
To: "'pgsql-cygwin(at)postgresql(dot)org'" <pgsql-cygwin(at)postgresql(dot)org>
Subject: rule question
Date: 2003-03-02 14:18:27
Message-ID: 00A42578900AD411BCFD00A0C978DC9304DC027F@mail.coba.usf.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)coba(dot)usf(dot)edu
______________________________________
I use Openoffice, the simple, free Office Suite for Windows/Linux/Macs that
works with existing documents. http://www.openoffice.org
 

Browse pgsql-cygwin by date

  From Date Subject
Next Message Jason Tishler 2003-03-03 14:14:46 Re: Problem installing postgesql/ipc-daemon
Previous Message Nyo Maw 2003-03-02 08:45:12 unexpected protocol charactor during authentication