[GENERAL] Trigger before delete does fire before, but delete doesn't not happen

2008-11-28 Thread Stéphane A. Schildknecht
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I'm faced with something like a comprehension problem. The exemple may be oversimplified, but, it seems same problem happens with updates. To simplify, I have triggers on 2 tables (commande and commandeligne). When deleting from table commande,

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

2008-11-28 Thread Adrian Klaver
On Friday 28 November 2008 3:47:10 am Stéphane A. Schildknecht wrote: > drop table commande cascade; > drop table commandeligne; > > CREATE TABLE commande > ( >   id integer NOT NULL, >   montant real, >   CONSTRAINT id PRIMARY KEY (id) > )with oids; > > CREATE TABLE commandeligne > ( >   id_comman

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

2008-11-30 Thread Stéphane A. Schildknecht
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Adrian Klaver a écrit : > On Friday 28 November 2008 3:47:10 am Stéphane A. Schildknecht wrote: >> drop table commande cascade; >> drop table commandeligne; >> >> CREATE TABLE commande >> ( >> id integer NOT NULL, >> montant real, >> CONSTRAINT i

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

2008-12-01 Thread Adrian Klaver
On Sunday 30 November 2008 11:18:12 pm Stéphane A. Schildknecht wrote: > Adrian Klaver a écrit : > > > > > > When I run this test case I get: > > > > test=# 2nd step : Deletion of command 1 > > test=# delete from commande where id=1; > > ERROR: update or delete on table "commande" vio

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

2008-12-01 Thread Adrian Klaver
On Monday 01 December 2008 7:27:48 am Adrian Klaver wrote: > On Sunday 30 November 2008 11:18:12 pm Stéphane A. Schildknecht wrote: > > > > > Adrian Klaver a écrit : > > > When I run this test case I get: > > > > > > test=# 2nd step : Deletion of command 1 > > > test=# delete from command

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

2008-12-01 Thread Tom Lane
Adrian Klaver <[EMAIL PROTECTED]> 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

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

2008-12-01 Thread Adrian Klaver
- "Tom Lane" <[EMAIL PROTECTED]> wrote: > Adrian Klaver <[EMAIL PROTECTED]> 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

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

2008-12-01 Thread Tom Lane
Adrian Klaver <[EMAIL PROTECTED]> 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 t

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

2008-12-02 Thread Stéphane A. Schildknecht
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tom Lane a écrit : > Adrian Klaver <[EMAIL PROTECTED]> 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 "

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

2008-12-02 Thread Adrian Klaver
On Tuesday 02 December 2008 3:19:11 am Stéphane A. Schildknecht wrote: > Tom Lane a écrit : > > Adrian Klaver <[EMAIL PROTECTED]> 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. > >> Thi