Re: [GENERAL] Trigger and deadlock

2013-07-30 Thread Loïc Rollus
Hi, It's ok. Before the insert, The foreign key constraint locked the row. If transaction A and B lock the row with FK, before doing UPDATE, they were stuck. I found a solution by creating an "before insert" trigger with a simple SELECT FROM UPDATE on the row. Loïc 2013/7

Re: [GENERAL] Trigger and deadlock

2013-07-29 Thread Loïc Rollus
/www.postgresql.org/docs/9.1/static/explicit-locking.html): "EXCLUSIVE: This lock mode is not automatically acquired on tables by any PostgreSQL command." In log, I just see that Hibernate just read the row y (365,42) (simple select). No explicit lock. Loïc 2013/7/29 Loïc Rollus >

Re: [GENERAL] Trigger and deadlock

2013-07-28 Thread Loïc Rollus
sert into X Process 22426 waits for ShareLock on transaction 1286782; blocked by process 22429. 1286785 22142 2013-07-26 13:55:25 CEST LOG: execute S_3: ROLLBACK I will try to query pg_locks to see more info Thanks 2013/7/26 Albe Laurenz > Loïc Rollus wrote: > > I've try t

[GENERAL] Trigger and deadlock

2013-07-26 Thread Loïc Rollus
Hello, I've try to make some concurrency robustness test with an web server app that use Hibernate and Postgres. It seems that my trigger make deadlock when multiple thread use it. I will try to simplify examples: I have a table "films"(id, title,director) and a table "directors"(id,name,nbreFilm