Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TSoIg-0007bM-Mg for pgsql-hackers@postgresql.org; Mon, 29 Oct 2012 12:18:38 +0000 Received: from mailout-us.gmx.com ([74.208.5.67]) by makus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TSoIf-0006ws-1f for pgsql-hackers@postgresql.org; Mon, 29 Oct 2012 12:18:37 +0000 Received: (qmail 21757 invoked by uid 0); 29 Oct 2012 12:18:35 -0000 Received: from 76.255.19.161 by rms-us016 with HTTP Cc: pgsql-hackers@postgresql.org,"Alvaro Herrera" Content-Type: text/plain; charset="utf-8" Date: Mon, 29 Oct 2012 08:18:33 -0400 From: "Kevin Grittner" Message-ID: <20121029121833.306930@gmx.com> MIME-Version: 1.0 Subject: Re: foreign key locks To: "Andres Freund" ,"Simon Riggs" X-Authenticated: #138763884 X-Flags: 0001 X-Mailer: GMX.com Web Mailer x-registered: 0 Content-Transfer-Encoding: 8bit X-GMX-UID: ThH8cIEW3zOlOQ09LnwhThl+IGRvb8AO X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201210/1499 X-Sequence-Number: 215735 Andres Freund wrote: > On Sunday, October 28, 2012 11:47:16 PM Simon Riggs wrote: >> Andres Freund wrote: >>> * Is it ok to make FOR UPDATE somewhat weaker than before? In 9.2 >>> and earlier you could be sure that if you FOR UPDATE'ed a row you >>> could delete it. Unless I miss something now this will not block >>> somebody else acquiring a FOR KEY SHARE lock, so this guarantee >>> is gone. >> >> Yes, that is exactly the point of this. > > The point is the introduction of a weaker lock level which can be > used by the ri triggers. I don't see any imperative that the > semantics of the old lock level need to be redefined. That just > seems dangerous to me. I agree with Andres here -- the new lock level is needed within RI triggers, and we might as well expose it for application programmer use (with proper documentations), but there's no reason to break existing application code by making the semantics of SELECT FOR UPDATE less strict than they were before. Let's keep that term meaning exactly the same thing if we can, and use new names for the new levels. We already present a barrier to people migrating from Oracle because SELECT FOR UPDATE in PostgreSQL is weaker than it is in Oracle (where it is just as strong as if an actual UPDATE were done -- write conflicts and all); let's not increase the barrier by making SELECT FOR UPDATE even weaker. -Kevin