X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id A58FACC323 for ; Tue, 15 Jul 2003 12:44:26 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 20303-01 for ; Tue, 15 Jul 2003 12:44:40 +0000 (GMT) Received: from mail.baltic-online.de (ns.baltic-online.de [62.8.212.2]) by svr1.postgresql.org (Postfix) with ESMTP id 23EABCBF37 for ; Tue, 15 Jul 2003 09:44:15 -0300 (ADT) Received: from laboe2.baltic-online.de ([62.8.212.14] helo=baltic-online.de) by mail.baltic-online.de with esmtp (Exim 3.33 #1) id 19cP6B-0003Pl-00 for pgsql-sql@postgresql.org; Tue, 15 Jul 2003 14:40:03 +0200 Received: from ebola.baltic-online.de ([10.0.0.31] verified) by baltic-online.de (CommuniGate Pro SMTP 3.5.9) with SMTP id 214853 for pgsql-sql@postgresql.org; Tue, 15 Jul 2003 14:44:39 +0200 Date: Tue, 15 Jul 2003 14:44:38 +0200 From: Jan Bernhardt To: pgsql-sql@postgresql.org Subject: Non-Blocking Locks (i.e. Oracle NOWAIT) Message-Id: <20030715144438.27550a7e.jb@baltic-online.de> Organization: Baltic Online Computer GmbH X-Mailer: Sylpheed version 0.9.0claws (GTK+ 1.2.10; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/165 X-Sequence-Number: 14279 Hi there, though this question has been asked several times before (but never really answered), I have to give it another try. I have a multi-user application which synchronizes access to certain datasets via the database itself. If a user has a project in that application open no other user should be able to work on it too. When developing the application I considered the database to be a place to handle the synchronization since transactions are (normally) an integral part of a database system. When a user opens a project the application firstly locks a corresponding row. But since I don't want the application to block if that row is already locked I use the Oracle "NOWAIT" feature (SELECT ... FOR UPDATE NOWAIT) which tries to receive the lock on the specified row and if that row is already locked it returns with an error without blocking and I can tell the user that the project is already in use. Now that the application is to be ported to PG I need a similar functionality. Is there that an animal? If not, what would you recommend? TIA, - Jan.