| От | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера