Re: SELECT ... FOR UPDATE

From: Cedar Cox <cedarc(at)visionforisrael(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: SELECT ... FOR UPDATE
Date: 2001-03-29 11:44:29
Message-ID: Pine.LNX.4.21.0103291339370.19150-100000@nanu.visionforisrael.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, 28 Mar 2001, Marcos Minshew wrote:

> I am interested in using the SELECT ... FOR UPDATE feature but it doesn't
> work quite the way I had hoped. If there is a better/different way of doing
> this please enlighten me.
>
> If I issue:
>
> BEGIN;
> SELECT * FROM atable WHERE atable.key = 10 FOR UPDDATE;
>
> in one session and then issue the same commands from a 2nd session, the 2nd
> session simply waits until the 1st session issues COMMIT or ROLLBACK. While
> the 2nd session is waiting I am, apparently locked out. What I would like
> is for the 2nd session to determine if the lock can be obtained and if not,
> offer the user a choice of waiting or escaping from the SELECT. Is this
> possible?
>
> Using 7.0.3

(I actually almost wrote an email asking this same question)

Has the documentation been updated recently or something I can find it
elsewhere (ie, not pg manual)? I think (maybe) I am not the only person
confused by documentation for LOCK and MVCC. "lack of detail / examples"
would probably say it best...

Thanks,
-Cedar

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Cedar Cox 2001-03-29 11:47:54 Re: Self-Referencing
Previous Message Cedar Cox 2001-03-29 11:38:24 Re: Function with now() | time 'now' | etc...