BUG #1459: Connection hangs when other connection is not committed - Mailing list pgsql-bugs

From Rainer Frey
Subject BUG #1459: Connection hangs when other connection is not committed
Date
Msg-id 20050203151126.467DC9A5818@www.postgresql.com
Whole thread Raw
Responses Re: BUG #1459: Connection hangs when other connection is not committed  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      1459
Logged by:          Rainer Frey
Email address:      rainer.frey@inxmail.de
PostgreSQL version: 8.0.1
Operating system:   Redhat Linux 9, Kernel 2.4.20-8, AMD Sempron 2500+, 1GB
RAM
Description:        Connection hangs when other connection is not committed
Details:

There seems to be a locking problem when not using autocommit. I came across
this in a relatively complex Java application, but could reproduce it with
the following scenario: (user test has priviledge to create db)
createdb -U test -W testdb
psql -U test -W testdb
CREATE TABLE test_table (id integer);
ALTER TABLE test_table ADD test integer;

now start another client session, disable autocommit:
psql -U test -W testdb
\set AUTOCOMMIT off
SELECT * FROM test_table;

Back in the first session, try to add another column:
ALTER TABLE test_table ADD test1 integer;

This hangs forever, until I commit session 2.
A select should not lock a table even when it is not committed.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #1458: to_char is crazy
Next
From: "Larson, Tim (Corporate)"
Date:
Subject: Re: BUG #1457: ./configure --with-openssl --enabled-thread-safety fails