Re: Unable to Delete a Row

Поиск
Список
Период
Сортировка
От Kevin Crenshaw
Тема Re: Unable to Delete a Row
Дата
Msg-id D8439C286CD66D4EBD89F853EBCE6E210F7BA4@ccs1.tiewireinc.com
обсуждение исходный текст
Ответ на Unable to Delete a Row  ("Kevin Crenshaw" <kcrenshaw@tiewireinc.com>)
Список pgsql-novice
Thanks for all of your help on this one!


kevin crenshaw


-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Wednesday, May 25, 2005 5:26 PM
To: Derrick Betts
Cc: Kevin Crenshaw; pgsql-novice@postgresql.org
Subject: Re: [NOVICE] Unable to Delete a Row

"Derrick Betts" <derrick@grifflink.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


В списке pgsql-novice по дате отправления:

Предыдущее
От: "Kevin Crenshaw"
Дата:
Сообщение: Re: PSQL under Windows XP
Следующее
От: John DeSoi
Дата:
Сообщение: Re: PSQL under Windows XP