X-Original-To: pgsql-odbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 2C5479FB2CE for ; Thu, 31 Aug 2006 09:55:23 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 87316-03-4 for ; Thu, 31 Aug 2006 09:55:14 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 1829D9FB3BE for ; Thu, 31 Aug 2006 09:53:20 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from www.freemail.gr (www.freemail.gr [81.171.104.45]) by svr4.postgresql.org (Postfix) with ESMTP id DFE425AF885 for ; Thu, 31 Aug 2006 12:53:18 +0000 (GMT) Received: from www.freemail.gr (www.freemail.gr [127.0.0.1]) by www.freemail.gr (8.12.11.20060308/8.12.11) with SMTP id k7VCrFwq015990 for ; Thu, 31 Aug 2006 15:53:15 +0300 Reply-To: anomatos@freemail.gr From: anomatos@freemail.gr To: pgsql-odbc@postgresql.org Subject: Re: Record locking issue using ODBC from .NET Date: Thu, 31 Aug 2006 15:53:15 +0300 Message-Id: <44f6dbbba743b5.02235290@freemail.gr> References: <44f6d60abb3116.51244977@freemail.gr> X-Authenticated-IP: ipa149.9.tellas.gr (84.254.9.149) X-Sender: anomatos@81.171.104.54 X-Mailer: FreeMail.gr 1.08 (http://www.freemail.gr/) X-Info-1: Report spam to abuse@freemail.gr MIME-version: 1.0 Content-type: text/plain; charset="iso-8859-7" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.753 tagged_above=0 required=5 tests=AWL, NO_REAL_NAME, SPF_SOFTFAIL X-Spam-Level: * X-Archive-Number: 200608/173 X-Sequence-Number: 8137 Please try the 8.2.0100 which would be released soon. If you are in a hurry, please install the 8.2.0002 version at http://pgfoundry.org/projects/psqlodbc/ . regars, Hiroshi Inoue > anomatos@freemail.gr wrote: > Hello there, > > I'm using version 8.01.02.00 of the PostgreSQL driver, any ideas? > > > > Hi Antonis, > > Which version of driver are you using ? > > > > regards, > > Hiroshi Inoue > > > > > anomatos@freemail.gr wrote: > > > > > > I want to have exclusive read access to a table row, so that if a client > > > has access to that row, any other client should either wait or get an > > > error of the type "could not obtain lock on row in relation 'customers'", > > > depending on the semantics used in the query string(nowait) > > > > > > Both clients execute: > > > > > > ... > > > OdbcTransaction ^ transaction = connection->BeginTransaction(); > > > String ^ query = "select * from customers where id = 3 for update nowait"; > > > OdbcCommand ^ cmd = (gcnew OdbcCommand(query, connection, transaction)); > > > reader = cmd->ExecuteReader(); > > > ... > > > > > > After the first client locks the record and before he ends the transaction, > > > the second tries to acquire the lock. As expected an exception is raised, > > > BUT: > > > > > > One would expect that this exception is of type OdbcException explaining that > > > "the lock cannot be aquired". Instead of this I get a > > > System::InvalidOperationException which disables my connection for some > > > reason. However the above exception hosts an inner exception of the desired > > > type(OdbcException). > > > > > > Does anybody have any idea why I get this type of behaviour, why is my > > > connection closed? > > > > > > Thanks a lot in advance, Antonis