On Wed, Dec 29, 2004 at 07:02:51 -0800,
Mark <sendmailtomark(at)yahoo(dot)com> wrote:
> 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.
You probably want to use LOCK. You can read the documention for that command
to help decide which lock you should take.
> Will 'SELECT FOR UPDATE' lock whole table?
No. It will only lock records visible to the current transaction.
In particular this won't keep other transactions from doing inserts
into the table.
> As per 'LOCK' will lock released if connection get closed abnormally?
I believe the locks get released when the backend process terminates.
Depending on how the client dies, there may be a significant delay before
the backend process terminates.
> ( example: hard crash on the client side, network interruptions,
> etc.) Can LOCK be used in JDBC or it's SQL92 standard?
I don't know, but I would be surprised if you couldn't.
In response to
pgsql-general by date
|Next:||From: Michael Fuhr||Date: 2004-12-29 18:20:34|
|Subject: Re: update table with row locking|
|Previous:||From: Bruno Wolff III||Date: 2004-12-29 17:38:35|
|Subject: Re: loading only few rows from huge table|