From: Dmitry Tkach <dmitry@openratings.com>
To: Jean-Christian Imbeault <jc@mega-bucks.co.jp>
Subject: Re: Locking rows
Date: Fri, 28 Feb 2003 17:25:58 -0500
Message-ID: <3E5FE1F6.7060504@openratings.com> (raw)
In-Reply-To: <3E5F931D.6090509@mega-bucks.co.jp>
References: <3E5F931D.6090509@mega-bucks.co.jp>
Jean-Christian Imbeault wrote:
> Doug McNaught wrote:
>
>>If you use a single query to generate the rows, this will not be a
>>problem.
>>
>>If you use multiple queries, execute them all inside a transaction and
>>you will get a consistent view of the database.
>>
>>No locking needed.
>
>
> True but what I am worried about is the data changing while I am in a
> transaction.
>
> Right now I want to print customer receipts for items that have been
> ordered. But while I gathering the data, which takes more than one
> query, a customer might come along and cancel an invoice.
>
> In that case I would print a receipt for something that was cancelled.
>
> I need to find a way to avoid this. I thought locking was a way around
> this ... or maybe I need to change my "business" logic or the way the
> app gathers the data?
>
But can't the customer cancel that invoice one millisecond *after* your application is done?
As far as I can see, from the customer's standpoint, it will look exactly the same, won't it?
Dima
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: dmitry@openratings.com, jc@mega-bucks.co.jp
Subject: Re: Locking rows
In-Reply-To: <3E5FE1F6.7060504@openratings.com>
References: <3E5F931D.6090509@mega-bucks.co.jp> <3E5FE1F6.7060504@openratings.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox