Skip site navigation (1) Skip section navigation (2)

Re: Foreign key order evaluation

From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Subject: Re: Foreign key order evaluation
Date: 2004-09-28 15:04:07
Message-ID: 41597D67.5090008@bigfoot.com (view raw or flat)
Thread:
Lists: pgsql-general
Michael Fuhr wrote:
> On Tue, Sep 28, 2004 at 01:30:08PM +0000, Randy Yates wrote:
> 
>>Randy Yates <yates(at)ieee(dot)org> writes:
>>
>>>I'm confused. Where is the lock? Is it on the 1 record in the model table?
> 
> 
> Yes.
> 
> 
>>>If so, why is that record locked? Is it possible in Postgresql to update
>>>the primary key of a record? 
> 
> 
> When you insert a row that has a foreign key reference, PostgreSQL
> does a SELECT FOR UPDATE on the referenced row in the foreign table;
> the lock prevents other transactions from changing the referenced
> row before this transaction completes.  Unfortunately it also
> prevents other transactions from acquiring a lock on the same row,
> so those transactions will block until the transaction holding the
> lock completes.

There are some proposal to have another kind of lock in order to avoid the
above. I hope soon.


Regards
Gaetano Mendola







In response to

pgsql-general by date

Next:From: Josh CloseDate: 2004-09-28 15:16:15
Subject: mssql linked server to postgres
Previous:From: Katsaros Kwn/nosDate: 2004-09-28 14:55:42
Subject: Re: Custom Functions

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group