Re: How to use locks, for DB noivces?

Поиск
Список
Период
Сортировка
От Chris Jones
Тема Re: How to use locks, for DB noivces?
Дата
Msg-id 20010309145211.N27501@mt.sri.com
обсуждение исходный текст
Ответ на How to use locks, for DB noivces?  (<drevil@sidereal.kz>)
Список pgsql-general
On Fri, Mar 09, 2001 at 09:12:55PM -0000, drevil@sidereal.kz wrote:

> I need this so that there isn't a race condition.  Ie, if there are
> $10 in the account, and one backen says "withdraw $9" and the other
> also says "withdraw $9" at the same time, I need to make sure they
> they don't execute at the same time, which would result in a negative
> balance.

In theory, you could also make a CHECK condition for that column that
would throw an exception if the balance goes negative.  Depending on
how your code is written, that might be easier or tougher.

Chris

--
chris@mt.sri.com -----------------------------------------------------
Chris Jones                                    SRI International, Inc.
                                                           www.sri.com

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

Предыдущее
От:
Дата:
Сообщение: Re: How to use locks, for DB noivces?
Следующее
От: "Brent R. Matzelle"
Дата:
Сообщение: Re: (blowfish in Postgres) Undefined symbol -- YAY!