Record locking issue using ODBC from .NET - Mailing list pgsql-odbc

From anomatos@freemail.gr
Subject Record locking issue using ODBC from .NET
Date
Msg-id 44f3fe8e70f865.32121596@freemail.gr
Whole thread Raw
Responses Re: Record locking issue using ODBC from .NET  (Hiroshi Inoue <inoue@tpf.co.jp>)
List pgsql-odbc
I want to have exclusive read access to a table row, so that if a client has access to that row, any other client
shouldeither wait or get an error of the type "could not obtain lock on row in relation 'customers'", depending on the
semanticsused 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
expectedan exception is raised, BUT: 

One would expect that this exception is of type OdbcException explaining that "the lock cannot be aquired". Instead of
thisI get a System::InvalidOperationException which disables my connection for some reason. However the above exception
hostsan 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


pgsql-odbc by date:

Previous
From: Avery Payne
Date:
Subject: Re: Visual FoxPro, PostgreSQL, and Dates (Long)
Next
From: Mark Morgan Lloyd
Date:
Subject: Re: Latest ODBC driver?