X-Original-To: pgsql-bugs-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 24D6B8B9FE6 for ; Fri, 4 Feb 2005 10:52:44 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01054-02 for ; Fri, 4 Feb 2005 10:52:39 +0000 (GMT) Received: from mail.inxnet.de (mail.inxmail.de [213.30.253.65]) by svr1.postgresql.org (Postfix) with ESMTP id 312DB8B9FE5 for ; Fri, 4 Feb 2005 10:52:40 +0000 (GMT) Received: from [192.168.1.142] (unknown [213.30.253.126]) by mail.inxnet.de (Postfix) with ESMTP id C35D514C025; Fri, 4 Feb 2005 11:52:37 +0100 (CET) Message-ID: <42035480.2060707@inxmail.de> Date: Fri, 04 Feb 2005 11:54:56 +0100 From: Rainer Frey Organization: Inxmail GmbH User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Peter Eisentraut Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #1459: Connection hangs when other connection is not References: <20050203151126.467DC9A5818@www.postgresql.com> <200502041054.16723.peter_e@gmx.net> In-Reply-To: <200502041054.16723.peter_e@gmx.net> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/76 X-Sequence-Number: 10908 Peter Eisentraut schrieb: > 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. 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? 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? Rainer Frey