Re: check if table/object is locked

From: Rod Taylor <rbt(at)rbt(dot)ca>
To: Jonathan Weiss <infojowe(at)gmx(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: check if table/object is locked
Date: 2003-03-09 15:35:39
Message-ID: 1047224138.28251.210.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Simple answer is don't lock it like that.

Store a 'last changed' date that you update when you change the tuple.
Confirm prior to writing that the 'last change' date hasn't changed
since you pulled out the information to display to the user (yes, do the
for update lock during this much shorter time).

On Sun, 2003-03-09 at 10:14, Jonathan Weiss wrote:
> hi!
>
>
> i have a problem. i developed an application for administrating cliet and
> their sales. if i want to edit a client i load him by select for update. now if
> another person want to update him, the query waits, until the first
> connection is closed. this is unacceptable, because the whole application is doing
> nothing until the db is responding. how can i check if the client is locked
> before i want to load him?
>
> thanks,
>
>
> Jonathan Weiss
--
Rod Taylor <rbt(at)rbt(dot)ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Vernon Wu 2003-03-09 19:53:44 Special characters in SQL queries
Previous Message Jonathan Weiss 2003-03-09 15:14:48 check if table/object is locked