X-Original-To: pgsql-general@postgreSQL.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1B746475F5F for ; Fri, 28 Feb 2003 13:14:44 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 84865-10 for ; Fri, 28 Feb 2003 13:14:31 -0500 (EST) Received: from ns.mega-bucks.co.jp (ns.mega-bucks.co.jp [219.118.175.241]) by postgresql.org (Postfix) with ESMTP id 4701D47619E for ; Fri, 28 Feb 2003 11:53:55 -0500 (EST) Received: from mega-bucks.co.jp (dhcp4.mega-bucks.co.jp [192.168.255.103]) by ns.mega-bucks.co.jp (8.12.6/8.12.5) with ESMTP id h1SGrQ7o018235; Sat, 1 Mar 2003 01:53:27 +0900 Message-ID: <3E5F931D.6090509@mega-bucks.co.jp> Date: Sat, 01 Mar 2003 01:49:33 +0900 From: Jean-Christian Imbeault User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en, ja MIME-Version: 1.0 To: Doug McNaught , pgsql-general@postgreSQL.org Subject: Re: Locking rows References: <3E5F396F.4090507@mega-bucks.co.jp> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Archive-Number: 200302/1705 X-Sequence-Number: 38459 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