Re: SELECT FOR UPDATE

Поиск
Список
Период
Сортировка
От Andrew G. Hammond
Тема Re: SELECT FOR UPDATE
Дата
Msg-id 20020312174622.GB19889@xyzzy.dhs.org
обсуждение исходный текст
Ответ на SELECT FOR UPDATE  (feblec@ig.com.br)
Список pgsql-sql
On Mon, Mar 11, 2002 at 10:31:32PM -0300, feblec@ig.com.br wrote:
> Any example ?  Or this is select not implemented ?  ( V7.2 )

It's implemented, and has been for a while.  Here's a trivial example.

BEGIN;
SELECT * FROM stuff WHERE stuff_id = '1' FOR UPDATE;
-- row 1 is now locked (exclusive), so we can do what needs doing
UPDATE stuff SET something = 'whatever' WHERE stuff_id = '1';
COMMIT;

This is covered in the manual, see
http://www2.ca.postgresql.org/users-lounge/docs/7.2/postgres/sql-select.html

I don't mind answering newbie questions like this in the appropriate
forum (pgsql-novice list for example).  In the future please at least
check the manual or give it a try before posting. :)

--
Andrew G. Hammond  mailto:drew@xyzzy.dhs.org  http://xyzzy.dhs.org/~drew/
56 2A 54 EF 19 C0 3B 43 72 69 5B E3 69 5B A1 1F              613-389-5481
5CD3 62B0 254B DEB1 86E0  8959 093E F70A B457 84B1
"To blow recursion you must first blow recur" -- me

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

Предыдущее
От: "Andrew G. Hammond"
Дата:
Сообщение: Re: in-date news items
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: in-date news items