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

From Peter Eisentraut
Subject Re: BUG #1459: Connection hangs when other connection is not committed
Date
Msg-id 200502041515.00657.peter_e@gmx.net
Whole thread Raw
In response to BUG #1459: Connection hangs when other connection is not committed  ("Rainer Frey" <rainer.frey@inxmail.de>)
Responses Re: BUG #1459: Connection hangs when other connection is not  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-bugs
Am Freitag, 4. Februar 2005 11:54 schrieb Rainer Frey:
> Thanks for the explanation, though I don't really get the necessity of a
> commit for a read-only statement. Can't a SELECT release its lock after
> it received the response?

If that is the end of the transaction, then you might as well commit it then.
But what if you plan to do an update in the same transaction based on the
selection results?  You can't release and reaquire locks in the same
transaction without getting into a bunch of trouble.  Read up on "strict
two-phase locking" if you're curious.

> Is there any possibility to set a timeout for the lock, after which the
> ALTER TABLE statement fails, instead of remaining in wait status (when
> calling with JDBC?

Yes, there is a statement_timeout parameter or something like that.

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

pgsql-bugs by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: BUG #1459: Connection hangs when other connection is not committed
Next
From: "Prabin Gade"
Date:
Subject: BUG #1461: pg_restore fails to authenticate on win