I'm always getting deadlocks like this:

[30-Mar-2003 19:19:51] PHP Fatal error:  postgres7 error: [0: ERROR:
deadlock detected
] in EXECUTE("INSERT INTO users_foods (user_id, date, meal_id, quantity,
eaten, food_id) VALUES ('55283', '2003-04-07', '1', '1.00', 'f', '779')")
 in /usr/local/www/generic/lib/adodb/adodb-errorhandler.inc.php on line 71


Why would an INSERT cause a deadlock problem?  Is this due to the FOR UPDATE
problem with foreign keys?

Chris


Mon, 31 Mar 2003 11:25:13 +0800
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au>
deadlock problem
Christopher Kings-Lynne wrote:
> I'm always getting deadlocks like this:
> 
> [30-Mar-2003 19:19:51] PHP Fatal error:  postgres7 error: [0: ERROR:
> deadlock detected
> ] in EXECUTE("INSERT INTO users_foods (user_id, date, meal_id, quantity,
> eaten, food_id) VALUES ('55283', '2003-04-07', '1', '1.00', 'f', '779')")
>  in /usr/local/www/generic/lib/adodb/adodb-errorhandler.inc.php on line 71
> 
> 
> Why would an INSERT cause a deadlock problem?  Is this due to the FOR UPDATE
> problem with foreign keys?

Is this in a transaction with other queries?  Are there foreign keys to
other tables that may be causing it.  I don't remember if INSERT locks
foreign tables, but it might.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073


Mon, 31 Mar 2003 11:39:46 -0500 (EST)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: deadlock problem

On Mon, 31 Mar 2003, Christopher Kings-Lynne wrote:

> I'm always getting deadlocks like this:
>
> [30-Mar-2003 19:19:51] PHP Fatal error:  postgres7 error: [0: ERROR:
> deadlock detected
> ] in EXECUTE("INSERT INTO users_foods (user_id, date, meal_id, quantity,
> eaten, food_id) VALUES ('55283', '2003-04-07', '1', '1.00', 'f', '779')")
>  in /usr/local/www/generic/lib/adodb/adodb-errorhandler.inc.php on line 71
>
>
> Why would an INSERT cause a deadlock problem?  Is this due to the FOR UPDATE
> problem with foreign keys?

Probably if this table is on either side of one.


Mon, 31 Mar 2003 08:41:59 -0800 (PST)
Stephan Szabo <sszabo@megazone23.bigpanda.com>
Re: deadlock problem
Christopher Kings-Lynne wrote:
> I'm always getting deadlocks like this:
> 
> [30-Mar-2003 19:19:51] PHP Fatal error:  postgres7 error: [0: ERROR:
> deadlock detected
> ] in EXECUTE("INSERT INTO users_foods (user_id, date, meal_id, quantity,
> eaten, food_id) VALUES ('55283', '2003-04-07', '1', '1.00', 'f', '779')")
>  in /usr/local/www/generic/lib/adodb/adodb-errorhandler.inc.php on line 71
> 
> 
> Why would an INSERT cause a deadlock problem?  Is this due to the FOR UPDATE
> problem with foreign keys?

I don't suppose a VACUUM is happening at the same time?  I've found
that 7.2.4 likes to give deadlocks during inserts into a table when
it's being VACUUMed (haven't tried it on 7.3.2 yet).


-- 
Kevin Brown					      kevin@sysexperts.com


Mon, 31 Mar 2003 15:41:28 -0800
Kevin Brown <kevin@sysexperts.com>
Re: deadlock problem