X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 92C445282F for ; Tue, 17 May 2005 09:31:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78449-01 for ; Tue, 17 May 2005 12:31:15 +0000 (GMT) Received: from mta10.nationwireless.net (mta10.nationwireless.net [63.163.128.10]) by svr1.postgresql.org (Postfix) with ESMTP id A90F952813 for ; Tue, 17 May 2005 09:31:13 -0300 (ADT) Received: from jfradkin [63.162.100.127] by mta10.nationwireless.net with ESMTP (SMTPD-8.20) id A414062C; Tue, 17 May 2005 08:31:16 -0400 From: "Joel Fradkin" To: "'Richard Huxton'" Cc: Subject: Re: getting duplicate number is there a Date: Tue, 17 May 2005 08:31:46 -0400 Message-ID: <000501c55adc$640855e0$797ba8c0@jfradkin> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit In-Reply-To: <42899927.9070801@archonet.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.953 tagged_above=0 required=5 tests=AWL, MSGID_DOLLARS X-Spam-Level: * X-Archive-Number: 200505/120 X-Sequence-Number: 21433 I actually had the same thought (a counter table, I might be able to add fields to the location table, but we have several applications case is just an example). I agree that is probably the safest way and it also fixes another issue I have been having when a user wants to transfer a case to another location. I appreciate the ideas, I could probably safely lock the numbering table as I would be afraid of locking the case table. Joel Fradkin I'd be tempted to have a case_numbers table with (year,location,max_num) and lock/read/insert to that. Makes everything explicit, and means you don't have to mess around with counts/substrings. -- Richard Huxton Archonet Ltd