Re: multiple statements.. and locking

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: multiple statements.. and locking
Дата
Msg-id
19076.1081225911@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
multiple statements.. and locking Benjamin <benjamin@netyantra.com>
Re: multiple statements.. and locking Tom Lane <tgl@sss.pgh.pa.us>
Benjamin  writes:
> I have a C application. I have to modify a row in a table, n then 
> immediately access a field in that row.
> These operation of modifying and accessing has to be atomic.So, i have 
> to lock the row.

The UPDATE in your example does that already; I think you should just
drop the LOCK ...

> BEGIN; LOCK TABLE tablename in ROW EXCLUSIVE MODE; UPDATE tablename set 
> colname=value WHERE rowprimary='a' ; SELECT b from tablename WHERE 
> rowprimary='a'; COMMIT;

			regards, tom lane
В списке pgsql-novice по дате отправления
От: Tom Lane
Дата:
От: Nabil Sayegh
Дата:
FAQ