I encountered the following log in 8.4.1 and HEAD. The deadlock occured
on the same object (relation 17498 of database 17497). Is it reasonable?
ERROR: deadlock detected
DETAIL: Process 6313 waits for ExclusiveLock on relation 17498 of database 17497; blocked by process 6312.
Process 6312 waits for ExclusiveLock on relation 17498 of database 17497; blocked by process 6313.
Process 6313: SELECT test()
Process 6312: SELECT test()
HINT: See server log for query details.
CONTEXT: SQL function "test" statement 1
STATEMENT: SELECT test()
(relation 17498 is table 'a')
A reproducible test set is:
----
CREATE TABLE a (i integer PRIMARY KEY);
CREATE TABLE b (i integer REFERENCES a(i));
CREATE FUNCTION test() RETURNS VOID AS
$$
LOCK a IN EXCLUSIVE MODE;
LOCK b IN EXCLUSIVE MODE;
DELETE FROM a;
$$
LANGUAGE sql STRICT;
----
# Repeat the following commands in shell.
psql -c "SELECT test()" &
psql -c "SELECT test()" &
psql -c "SELECT test()" &
wait
Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center
Responses
pgsql-hackers by date
| Next: | From: Josh Berkus | Date: 2009-11-11 04:14:45 |
| Subject: Re: Parsing config files in a directory |
| Previous: | From: Tom Lane | Date: 2009-11-10 23:15:19 |
| Subject: Re: [HACKERS] PostgreSQL 8.3.8 on AIX5.3 : compilation failed |