Re: Transactions and RowExclusive locks on foreign key tables - Mailing list pgsql-bugs

From Stephan Szabo
Subject Re: Transactions and RowExclusive locks on foreign key tables
Date
Msg-id 20030313100750.V68611-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Transactions and RowExclusive locks on foreign key tables  ("Donald Fraser" <demolish@cwgsy.net>)
List pgsql-bugs
On Thu, 13 Mar 2003, Donald Fraser wrote:

> I have a question regarding transactions.

> When updating a row of a table PostgreSQL obtains a RowExclusive lock,
> which according to the docs means that no other transaction can obtain
> a RowExclusive lock on this row in the same table until the existing
> one is released. That seems fair enough when inserting, updating or
> deleting rows from a table.
>
> But why does PostgreSQL need a RowExclusive lock on the foreign key
> table when it is not going to update the row in the foreign key table?
> Surely it only needs a sharable lock that stops other transactions
> updating or deleting this row.

There isn't currently such a lock in PostgreSQL, the row exclusive lock
was what was available at the time.  This has been discussed on -general
and -hackers in the near past, you might want to look at the archives.

pgsql-bugs by date:

Previous
From: "Donald Fraser"
Date:
Subject: Transactions and RowExclusive locks on foreign key tables
Next
From: Oliver Elphick
Date:
Subject: now() and date_trunc() apparently corrupting data