X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8C3CF47638F for ; Fri, 18 Apr 2003 19:02:19 -0400 (EDT) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 1A73247638C for ; Fri, 18 Apr 2003 19:02:19 -0400 (EDT) Received: by news.hub.org (Postfix, from userid 8) id F250E43A89E; Fri, 18 Apr 2003 19:02:18 -0400 (EDT) X-Abuse-Report: abuse@teranews.com Message-ID: <1e83d3494141f5a5be1ad65b3ebd1756@news.teranews.com> Date: Fri, 18 Apr 2003 22:58:09 GMT Lines: 32 From: foo2@on-spammers2.com X-Newsgroups: comp.databases.postgresql.sql Subject: New to SQL; hopefully simple question Reply-To: the2@newsgroup2.com X-Newsreader: Forte Agent 1.92/32.572 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: pgsql-sql@postgresql.org X-Spam-Status: No, hits=-2.1 required=5.0 tests=BAYES_20,NO_REAL_NAME version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/338 X-Sequence-Number: 13039 I have a situation where I want to keep a bunch of ordinals in a row of a table maintained by the database. From this table, I want to obtain a number, and increment it in the table. This is the general idea, abstracted to the key parts (and it works, as far as it goes: "select valueone from ordtable" VALUE = PQgetvalue(res,0,0) ...compute VALUE = VALUE + 1 "update ordtable SET valueone = VALUE" ...as I said, this works. however, as far as I understand it, it's divisible and thus subject to multi-user fugue. What I need, conceptually, is: lock the table so anyone else waits for the unlock (not fails, waits) do the above unlock the table Can anyone point me in the right direction for this? I looked at lock, but it seems to only apply across one DB action. Yes? No? Thanks! Walt Walt Software Engineer Black Belt Systems pages: http://www.blackbeltsystems.com/ email: http://www.blackbeltsystems.com/contact.html