From: | Mark <sendmailtomark(at)yahoo(dot)com> |
---|---|
To: | Michael Fuhr <mike(at)fuhr(dot)org> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: update table with row locking |
Date: | 2004-12-29 15:02:51 |
Message-ID: | 20041229150251.84146.qmail@web40901.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
In general I need to lock whole table so only one session can
perform update. I'm looking for solution that will work in both C++
and Java.
Will 'SELECT FOR UPDATE' lock whole table?
As per 'LOCK' will lock released if connection get closed abnormally?
( example: hard crash on the client side, network interruptions,
etc.) Can LOCK be used in JDBC or it's SQL92 standard?
Thanks a lot.
Mark
--- Michael Fuhr <mike(at)fuhr(dot)org> wrote:
> On Thu, Dec 23, 2004 at 11:56:26AM -0800, Mark wrote:
>
> > Is it possible to lock row(s) when updating a table, so another
> call
> > for update( from different session) will be rejected and to be on
> > hold until lock get released ?
>
> The UPDATE statement automatically acquires locks, but if you need
> more control then you could use SELECT FOR UPDATE or LOCK. For
> more information see the "Concurrency Control" chapter in the
> documentation.
>
> What problem are you trying to solve? Depending on what you're
> doing, you might not need to use explicit locking.
>
> --
> Michael Fuhr
> http://www.fuhr.org/~mfuhr/
>
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
From | Date | Subject | |
---|---|---|---|
Next Message | girgen | 2004-12-29 15:18:03 | using pg_config to get LDFLAGS? |
Previous Message | Edgars Diebelis | 2004-12-29 08:59:01 | Re: 8.0 Beta3 worked, RC1 didn't! |