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/29 Loïc Rollus

Re: [GENERAL] Trigger and deadlock

2013-07-30 Thread Albe Laurenz
Loïc Rollus wrote: 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. You mean SELECT

Re: [GENERAL] Trigger and deadlock

2013-07-29 Thread Loïc Rollus
Hi, Thanks for your quick reply! I found the table. But the ctid of the row has changed. But during my test, I update only 1 row from this table, so I know the row. I had already put log_statement to 'all'. It's strange because in the log, I only see simple SELECT ... FROM on this table (no

Re: [GENERAL] Trigger and deadlock

2013-07-29 Thread Loïc Rollus
Here is pg_lock for relation Y (= 2027300) locktype | database | relation | page | tuple | virtualxid | transactionid | classid | objid | objsubid | virtualtransaction | pid | mode | granted

[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,nbreFilms).

Re: [GENERAL] Trigger and deadlock

2013-07-26 Thread Albe Laurenz
Loïc Rollus wrote: 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