Re: FOR KEY LOCK foreign keys

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: FOR KEY LOCK foreign keys
Date: 2011-07-27 23:16:44
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


This is an updated version of the patch I introduced here:

Mainly, this patch addresses the numerous comments by Noah Misch here:
My thanks to Noah for the very exhaustive review and ideas.

I also removed the bit about copying the ComboCid to the new version of
the tuple during an update. I think that must have been the result of
very fuzzy thinking; I cannot find any reasoning that leads to it being
necessary, or even correct.

I also included Marti Raudsepp's patch to consider only indexes usable
in foreign keys.

One thing I have not addressed is Noah's idea about creating a new lock
mode, KEY UPDATE, that would let us solve the initial problem that this
patch set to resolve in the first place. I am not clear on exactly how
that is to be implemented, because currently heap_update and heap_delete
do not grab any kind of lock but instead do their own ad-hoc waiting. I
think that might need to be reshuffled a bit, to which I haven't gotten
yet, and is a radical enough idea that I would like it to be discussed
by the hackers community at large before setting sail on developing it.
In the meantime, this patch does improve the current situation quite a

Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Attachment Content-Type Size
fklocks-2.patch application/octet-stream 74.9 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-07-27 23:28:16 Re: Is a heads-up in 9.1 in order regarding the XML-related changes in 9.2?
Previous Message Florian Pflug 2011-07-27 22:24:40 Re: patch for 9.2: enhanced errors