From: | "Kevin Crenshaw" <kcrenshaw(at)tiewireinc(dot)com> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Derrick Betts" <derrick(at)grifflink(dot)com> |
Cc: | <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Unable to Delete a Row |
Date: | 2005-05-30 13:53:37 |
Message-ID: | D8439C286CD66D4EBD89F853EBCE6E210F7BA4@ccs1.tiewireinc.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Thanks for all of your help on this one!
kevin crenshaw
-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Wednesday, May 25, 2005 5:26 PM
To: Derrick Betts
Cc: Kevin Crenshaw; pgsql-novice(at)postgresql(dot)org
Subject: Re: [NOVICE] Unable to Delete a Row
"Derrick Betts" <derrick(at)grifflink(dot)com> writes:
> I think that you need to "RETURN NEW;" in your tg_remove_contact()
> function rather than "RETURN NULL;"
Actually, since it's a DELETE trigger, there is no NEW row;
he needs to RETURN OLD, instead, to give permission for the delete
to continue.
Given what the trigger is doing (ie, propagating the update to another
table), he might be better off to use an AFTER DELETE trigger instead
of BEFORE DELETE anyway --- in which case the return value doesn't
matter and so RETURN NULL is fine. The point of AFTER DELETE is that
you can be certain the delete really did happen, and wasn't cancelled
by some other BEFORE DELETE trigger.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | John DeSoi | 2005-05-30 14:13:07 | Re: PSQL under Windows XP |
Previous Message | Kevin Crenshaw | 2005-05-30 13:52:30 | Re: PSQL under Windows XP |