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>)
Список pgsql-novice
Benjamin <benjamin@netyantra.com> 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
Дата:
Сообщение: Re: Help for MSSQL "Compute" equivalent in Postgres
Следующее
От: Nabil Sayegh
Дата:
Сообщение: Re: 7.4 dramatically slower than 7.3? (was: snowflaking)