Re: [GENERAL] Stored Procedure and Trigger they puzzle me

2006-12-20 Thread Lars Heidieker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 19 Dec 2006, at 11:44, Albe Laurenz wrote: Actually I just figured out, that is is not the trigger but the two cascade on update triggers collide. It happens also without the trigger: lt=# UPDATE ltlocation SET id = 4 WHERE id = 18999; ERRO

Re: [GENERAL] Stored Procedure and Trigger they puzzle me

2006-12-19 Thread Albe Laurenz
> Actually I just figured out, that is is not the trigger but the two > cascade on update triggers collide. > It happens also without the trigger: > > lt=# UPDATE ltlocation SET id = 4 WHERE id = 18999; > ERROR: insert or update on table "ltlocationpath" violates foreign > key constraint

Re: [GENERAL] Stored Procedure and Trigger they puzzle me

2006-12-19 Thread Lars Heidieker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 19 Dec 2006, at 10:30, Lars Heidieker wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 19 Dec 2006, at 08:56, Alban Hertroys wrote: Not sure as I deleted them before, but currently I cant reproduce it. I just get the following now

Re: [GENERAL] Stored Procedure and Trigger they puzzle me

2006-12-19 Thread Lars Heidieker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 19 Dec 2006, at 08:56, Alban Hertroys wrote: Not sure as I deleted them before, but currently I cant reproduce it. I just get the following now: ERROR: insert or update on table "ltlocationpath" violates foreign key constraint "ltlocanceste

Re: [GENERAL] Stored Procedure and Trigger they puzzle me

2006-12-19 Thread Lars Heidieker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 19 Dec 2006, at 08:45, Albe Laurenz wrote: With your examples I can reproduce the error and explain what is going on. test=> select * from ltlocation; id | name | description | parent | type ---+-+-

Re: [GENERAL] Stored Procedure and Trigger they puzzle me

2006-12-19 Thread Alban Hertroys
Lars Heidieker wrote: The strange thing is: insert is OK (materialized path gets populated) update of parent column is OK old values get delete and new ones get inserted but if the exception handling of the unique_violation exception is removed an update on the id colu

Re: [GENERAL] Stored Procedure and Trigger they puzzle me

2006-12-19 Thread Albe Laurenz
> CREATE TABLE ltlocation ( >"id" integer DEFAULT nextval('ltlocation_id_seq'::text) NOT NULL, >name varchar(30) NOT NULL default '', >"description" varchar(254) NOT NULL default '', >"parent" int4, >type int2 NOT NULL default '0', >PRIMARY KEY (id) > ) ; > > just to hold

Re: [GENERAL] Stored Procedure and Trigger they puzzle me

2006-12-18 Thread Lars Heidieker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 18 Dec 2006, at 09:37, Alban Hertroys wrote: Lars Heidieker wrote: Hi all, I just started to write my first stored procedure in plpgsql and installed a trigger for it. The two Tables are: CREATE TABLE ltlocation ( "id" integer DEFAULT next

Re: [GENERAL] Stored Procedure and Trigger they puzzle me

2006-12-18 Thread Lars Heidieker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 18 Dec 2006, at 09:26, Albe Laurenz wrote: The strange thing is: insert is OK (materialized path gets populated) update of parent column is OK old values get delete and new ones get inserted but if the exception handling of the unique_violation

Re: [GENERAL] Stored Procedure and Trigger they puzzle me

2006-12-18 Thread Alban Hertroys
Lars Heidieker wrote: > Hi all, > > I just started to write my first stored procedure in plpgsql and > installed a trigger for it. > > The two Tables are: > > CREATE TABLE ltlocation ( > "id" integer DEFAULT nextval('ltlocation_id_seq'::text) NOT NULL, > name varchar(30) NOT NULL default '',

Re: [GENERAL] Stored Procedure and Trigger they puzzle me

2006-12-18 Thread Albe Laurenz
> The strange thing is: > insert is OK (materialized path gets populated) > update of parent column is OK old values get delete and new ones get > inserted > but if the exception handling of the unique_violation exception is > removed an update on the id column fails, with > an duplicate pkey v