Re: row-level locking

Поиск
Список
Период
Сортировка
От Jean-Christian Imbeault
Тема Re: row-level locking
Дата
Msg-id 3E8976DA.5070803@mega-bucks.co.jp
обсуждение исходный текст
Ответ на row-level locking  (Markus Wagner <wagner@imbei.uni-mainz.de>)
Список pgsql-general
Markus Wagner wrote:
>
> We found a short description for the "SELECT FOR UPDATE" statement:
> "perform exclusive locking of selected rows"
>
> Now my question: Is this a good method for our purpose?

I had the same question not too long ago.

It's a great method.

It doesn(t have to be in an explicit transaction as all postgres sql
statements are executed in their own transactions. The row will be
locked until your transaction (implicit or explicit) is commited or
rolled-back.

 From a VB application the tricky part will be finding out how to start
an explicit transaction and then committing it.

For example I found out that in Java:

SELECT ... FOR UPDATE;
[do some stuff on the row]

Did not lock the rows as expected since Java automatically "committed"
the implicit transaction around the "SELECT ... FOR UPDATE" statement.

I had to turn off the default transaction commital of the JDBC, execute
my query/statement and *then* explicitly commit the transaction.

VB and ODBC might need something similar.

HTH,

Jean-Christian Imbeault


В списке pgsql-general по дате отправления:

Предыдущее
От: Markus Wagner
Дата:
Сообщение: row-level locking
Следующее
От: "Nigel J. Andrews"
Дата:
Сообщение: Re: row-level locking