Re: [araman@india-today.com: locking problem with JDBC (suspicion)] - Mailing list pgsql-general

From Anand Raman
Subject Re: [araman@india-today.com: locking problem with JDBC (suspicion)]
Date
Msg-id 20010213211449.E25941@india-today.com
Whole thread Raw
In response to Re: [araman@india-today.com: locking problem with JDBC (suspicion)]  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [araman@india-today.com: locking problem with JDBC (suspicion)]
Re: [araman@india-today.com: locking problem with JDBC (suspicion)]
List pgsql-general
hi guys

On Tue, Feb 13, 2001 at 10:07:57AM -0500, Tom Lane wrote:
>"Richard Huxton" <dev@archonet.com> writes:
>> Well, foreign keys enforce constraints so it's not unreasonable that the
>> lock might extend to the referenced tables.
>

thanx tom
I got this point after pondering over it for some time..


>Precisely.  The SELECT FOR UPDATE is done to ensure that the referenced
>rows don't go away before the update of the referencing table commits.
>

>I'm guessing that Anand's not shown us all the operations involved,
>and that when things hang up it's because there are two different
>transactions trying to lock overlapping sets of referenced rows.
>Hard to tell from the info we have, however.

as far as the entire picture is concerned here it comes..

EXHIBITS ------> EXHIBIT_DISTRIBUTIONS --- EXHIBIT_PRICES

where EXHIBITS is the primary table and has a one to many relationaship
with EXHIBIT_DISTRIBUTIONS. EXHIBIT_DISTRIBUTIONS has a one to one
relationship with EXHIBIT_PRICES.

In my web applicaiton i am first inserting the rows into EXHIBITS table
and in the next page ask the user to insert details regarding the
EXHIBIT_DISTRIBUTIONS. I pass the primary key from the first form to the
second and subsequently use it for inserting rows in
EXHIBIT_DISTRIBUTIONS.

The entire process works smoothly for the first few time.. However it
hangs when i repeat the process for more than 3 times..

I fail to understand if there is a problem then it would manifest itself
in the very first time.. HOwever why should it show upon the third
insert..

I can attach the postgres log files and the creation scripts if it helps..

Thanks for any suggestion..

Anand
>
>            regards, tom lane

pgsql-general by date:

Previous
From: Anand Raman
Date:
Subject: Re: strange query results
Next
From: Fred Yankowski
Date:
Subject: Re: Re: ALTER DROP COLUMN