Re: How to use locks, for DB noivces? - Mailing list pgsql-general

From Chris Jones
Subject Re: How to use locks, for DB noivces?
Date
Msg-id 20010309145211.N27501@mt.sri.com
Whole thread Raw
In response to How to use locks, for DB noivces?  (<drevil@sidereal.kz>)
List 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 by date:

Previous
From:
Date:
Subject: Re: How to use locks, for DB noivces?
Next
From: "Brent R. Matzelle"
Date:
Subject: Re: (blowfish in Postgres) Undefined symbol -- YAY!