Search Postgresql Archives

Re: Trigger before delete does fire before, but delete doesn't not happen

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 02 December 2008 3:19:11 am Stéphane A. Schildknecht wrote:
> Tom Lane a écrit :
> > Adrian Klaver <aklaver@xxxxxxxxxxx> writes:
> >> Thanks for the explanation. Just so I am clear,the act of updating the
> >> row in p_commandeligne_ad creates a new tuple for the row with id of 1.
> >> This means the original statement "delete from commande where id=1" runs
> >> against a version of the row that no longer exists and becomes a no-op
> >> statement. This happens because the trigger was run as BEFORE and
> >> changed the row from under the original statement.
> >
> > Right.
> >
> > 			regards, tom lane
>
> Thanks for having helped me understand better why it couldn't be a logical
> way of acting.
>
> Best regards,

Actually there is a logic to it once you realize that an UPDATE in Postgres is 
really a DELETE and INSERT operation. It is a concept that still catches me 
on a regular basis.  To see what is going on substitute ctid for oid in your 
test case. This will show that the ctid(current tuple id) is changing for the 
row you are deleting in commande. 

-- 
Adrian Klaver
aklaver@xxxxxxxxxxx

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux