Received: from pavidus.matematik.su.se (pavidus.matematik.su.se [130.237.198.6]) by hub.org (8.9.2/8.9.1) with ESMTP id EAA18606 for ; Thu, 28 Jan 1999 04:13:02 -0500 (EST) (envelope-from marcusb@matematik.su.se) Received: from unreal.matematik.su.se (unreal.matematik.su.se [130.237.198.46]) by pavidus.matematik.su.se (8.8.8/8.6.9) with ESMTP id KAA01042 for ; Thu, 28 Jan 1999 10:11:58 +0100 X-Address: Department of Mathematics, Stockholm University S-106 91 Stockholm SWEDEN X-Phone: int+46 8 162000 X-Fax: int+46 8 6126717 X-Url: http://www.matematik.su.se Received: (from marcusb@localhost) by unreal.matematik.su.se (8.9.1a/8.9.1) id KAA07562; Thu, 28 Jan 1999 10:12:58 +0100 From: Marcus Better MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Thu, 28 Jan 1999 10:12:56 +0100 (CET) To: pgsql-sql@postgresql.org Subject: Serial numbers In-Reply-To: <105463668@toto.iv> X-Mailer: VM 6.43 under 20.4 "Emerald" XEmacs Lucid Message-ID: <14000.10525.469359.464174@unreal.matematik.su.se> Herouth Maoz writes: > So, the inserts for the ccats table become: > > INSERT INTO ccats (cid, catid) VALUES (currval( 'name of seq' ), 5 ); What if someone does another INSERT between the two INSERTs, then the number generator is stepped and the second table gets the wrong serial number. Should one use LOCK here? Marcus