Re: Non-Blocking Locks (i.e. Oracle NOWAIT)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jan Bernhardt <jb(at)baltic-online(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Non-Blocking Locks (i.e. Oracle NOWAIT)
Date: 2003-07-15 15:17:35
Message-ID: 22695.1058282255@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Jan Bernhardt <jb(at)baltic-online(dot)de> writes:
> 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.

You might be able to use the contrib/userlock module for this.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2003-07-15 15:25:59 Re: Cannot insert dup id in pk
Previous Message Dmitry Tkach 2003-07-15 15:16:33 Re: Non-Blocking Locks (i.e. Oracle NOWAIT)