Re: How to use locks, for DB noivces?

From: Chris Jones <chris(at)mt(dot)sri(dot)com>
To: drevil(at)sidereal(dot)kz
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to use locks, for DB noivces?
Date: 2001-03-09 21:52:11
Message-ID: 20010309145211.N27501@mt.sri.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Mar 09, 2001 at 09:12:55PM -0000, drevil(at)sidereal(dot)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(at)mt(dot)sri(dot)com -----------------------------------------------------
Chris Jones SRI International, Inc.
www.sri.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Brent R. Matzelle 2001-03-09 21:54:38 Re: (blowfish in Postgres) Undefined symbol -- YAY!
Previous Message drevil 2001-03-09 21:37:05 Re: How to use locks, for DB noivces?