Re: Trigger before delete does fire before, but delete doesn't not happen
От | Adrian Klaver |
---|---|
Тема | Re: Trigger before delete does fire before, but delete doesn't not happen |
Дата | |
Msg-id | 779447495.987121228163527348.JavaMail.root@sz0030a.emeryville.ca.mail.comcast.net обсуждение исходный текст |
Ответы |
Re: Trigger before delete does fire before, but delete doesn't not happen
|
Список | pgsql-general |
----- "Tom Lane" <tgl@sss.pgh.pa.us> wrote: > Adrian Klaver <aklaver@comcast.net> writes: > > The problem as far as I can tell is tuple visibility. > > Sort of: the triggers on commandeligne fire (and update the commande > row) > at completion of the DELETE command inside p_commande_bd. This means > that by the time control returns from that trigger, the tuple version > that was targeted for deletion is already dead, so there's nothing to > do. It doesn't chain up to the newer version of the row. > Thanks for the explanation. Just so I am clear,the act of updating the row in p_commandeligne_ad creates a new tuple forthe row with id of 1. This means the original statement "delete from commande where id=1" runs against a version of therow that no longer exists and becomes a no-op statement. This happens because the trigger was run as BEFORE and changedthe row from under the original statement. > regards, tom lane Adrian Klaver aklaver@comcast.net
В списке pgsql-general по дате отправления: