RE: Lock rekord

Поиск
Список
Период
Сортировка
От Andrew Snow
Тема RE: Lock rekord
Дата
Msg-id NHEALMDKDACEIPBNOOOCOEMICFAA.als@fl.net.au
обсуждение исходный текст
Ответ на Re: Lock rekord  (Herbert Liechti <Herbert.Liechti@thinx.ch>)
Список pgsql-general
> I usually prefer the following trick for preventing long locking
> times. On every
> table I define a timestamp field which is updated every time the record is
> written to the database. If a user edits a record (without
> locking) and commit his changes
> the timestamp is returned from the client program unchanged. The program
> reads the record again for update and compares the timestamp from
> the database
> and the timestamp from the user program.  If the timestamp has changed
> in the meantime the record was updated from someone else and the
> transaction will be rejected.

What happens if someone else updates the record *just* after the record is
reread for update and timestamp compared?


- Andrew



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

Предыдущее
От: Herbert Liechti
Дата:
Сообщение: Re: Lock rekord
Следующее
От: Vipin Samtani
Дата:
Сообщение: ALTER TABLE to add Foreign Key Constraint