pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: Rainer Frey <rainer.frey@inxmail.de>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #1459: Connection hangs when other connection is not committed
Date: Fri, 4 Feb 2005 10:54:16 +0100
Message-ID: <200502041054.16723.peter_e@gmx.net> (raw)
In-Reply-To: <20050203151126.467DC9A5818@www.postgresql.com>
References: <20050203151126.467DC9A5818@www.postgresql.com>

Am Donnerstag, 3. Februar 2005 16:11 schrieb Rainer Frey:
> A select should not lock a table even when it is not committed.

The SELECT obtains a read (shared) lock on the table, but the ALTER TABLE 
requires a write (exclusive) lock.  This is certainly necessary because you 
don't want the structure of the table to be changed while you are reading it.  
Additionally, the locking protocol requires that all locks once obtained need 
to be held until the end of the transaction.  Both of these issues together 
explain the problem you are seeing.  There is nothing that can be done about 
it.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/



view thread (6+ messages)  latest in thread

Message-ID: <200502041054.16723.peter_e@gmx.net>
Permalink:  ../200502041054.16723.peter_e@gmx.net/
Also on:    postgresql.org/message-id/200502041054.16723.peter_e@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: peter_e@gmx.net, rainer.frey@inxmail.de, pgsql-bugs@postgresql.org
  Subject: Re: BUG #1459: Connection hangs when other connection is not committed
  In-Reply-To: <200502041054.16723.peter_e@gmx.net>
  References: <20050203151126.467DC9A5818@www.postgresql.com> <200502041054.16723.peter_e@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox