Re: Locking rows

From: Dmitry Tkach <dmitry(at)openratings(dot)com>
To: Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp>
Subject: Re: Locking rows
Date: 2003-02-28 22:25:58
Message-ID: 3E5FE1F6.7060504@openratings.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dmitry Tkach 2003-02-28 22:28:25 Re: postgresql caching
Previous Message Francisco J Reyes 2003-02-28 22:23:24 Re: reindex vs. drop index , create index