Re: Transactions and RowExclusive locks on foreign key tables

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Donald Fraser <demolish(at)cwgsy(dot)net>
Cc: "[BUGS]" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Transactions and RowExclusive locks on foreign key tables
Date: 2003-03-13 18:10:03
Message-ID: 20030313100750.V68611-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Oliver Elphick 2003-03-13 22:03:37 now() and date_trunc() apparently corrupting data
Previous Message Donald Fraser 2003-03-13 17:57:39 Transactions and RowExclusive locks on foreign key tables