Re: possible to lock a single row in table?

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: possible to lock a single row in table?
Дата
Msg-id Pine.LNX.4.30.0106201750500.725-100000@peter.localdomain
обсуждение исходный текст
Ответ на possible to lock a single row in table?  (bboett@erm1.u-strasbg.fr (Bruno Boettcher))
Список pgsql-sql
Bruno Boettcher writes:

> i have a lots of threads that work on a table, making insertions,
> updates removes.....
>
> now i certain cases its important to keep data integrity, so i looked
> into locks....

Only in certain cases??? ;-)

> all i found was a lock function that locks the entire table....

There are also row level locks, which are automatically acquired when
needed.  The best way to lock specific rows is the SELECT ... FOR UPDATE
statement.  Playing with the LOCK command is generally not necessary.

> and what happens to other insert queries whilst the lock is operational?
> Are they postponed and the valling thread waits, or does the call return
> with an error?

That depends on the transaction isolation level (which you can set).  See
the chapter on concurrency control in the User's Guide for more
information.

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter



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

Предыдущее
От: David BOURIAUD
Дата:
Сообщение: Help on a sql querry.
Следующее
От: hughmandeville@hotmail.com (Hugh Mandeville)
Дата:
Сообщение: Re: binary data