Re: Locking rows - Mailing list pgsql-general

From Jean-Christian Imbeault
Subject Re: Locking rows
Date
Msg-id 3E5F931D.6090509@mega-bucks.co.jp
Whole thread Raw
In response to Locking rows  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
Responses Re: Locking rows
Re: Locking rows
Re: Locking rows
Re: Locking rows
List pgsql-general
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?

Jc


pgsql-general by date:

Previous
From: Ericson Smith
Date:
Subject: Recreating a primary key
Next
From: Manfred Koizar
Date:
Subject: Re: Locking rows