Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TTe4n-00044t-WF for pgsql-hackers@postgresql.org; Wed, 31 Oct 2012 19:35:46 +0000 Received: from mail-vc0-f174.google.com ([209.85.220.174]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TTe4j-0003Ha-8S for pgsql-hackers@postgresql.org; Wed, 31 Oct 2012 19:35:44 +0000 Received: by mail-vc0-f174.google.com with SMTP id fk26so1908893vcb.19 for ; Wed, 31 Oct 2012 12:35:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent :x-gm-message-state; bh=HEu4XA+5Hhq21V7oho4hcOZoSvYGUPOgKv+qza7xmAQ=; b=VfF3elY6jmNJ/dP1qnIfCA3QPQuQA1un82/f+BL0fnFQhTcqUVeE/EK+oiMBi7hK0j ka1fJ60R2C/4NYBVGNavEAnxrwiSPYXSdKmab+4Y92jLWtz8aD61zQg/QRKgw/o8kiOT OBNZ/3FFt4l5TxbMDQNdLMQFPdEgcD2KJcqPVuyuQ2UGmIpvxgZ8uIECAbI5KEevWm3h k45AnnHeOY4aDuYG/+XHbfWjlF72Xz0fY2m94h8nEcCprOXJHmwOSwCRxwpJEc99nd70 z0cYVyl66Kc70kVtAk112aUUDGuxyx4MDWwG1JjbRsaz93BGrBLV9UhO2cEieSYvBW0g 3FZw== Received: by 10.52.77.101 with SMTP id r5mr48108634vdw.25.1351712139775; Wed, 31 Oct 2012 12:35:39 -0700 (PDT) Received: from tornado.leadboat.com (ip68-105-236-221.hr.hr.cox.net. [68.105.236.221]) by mx.google.com with ESMTPS id q7sm2605395vdw.22.2012.10.31.12.35.38 (version=SSLv3 cipher=OTHER); Wed, 31 Oct 2012 12:35:38 -0700 (PDT) Date: Wed, 31 Oct 2012 15:35:36 -0400 From: Noah Misch To: Kevin Grittner Cc: Andres Freund , Simon Riggs , pgsql-hackers@postgresql.org, Alvaro Herrera Subject: Re: foreign key locks Message-ID: <20121031193536.GA1651@tornado.leadboat.com> References: <20121029121833.306930@gmx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121029121833.306930@gmx.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-Gm-Message-State: ALoCoQlSFcJnh4jdET41mFdC/z1f7duzlJ92ZiwG93oJGd8iP2PTuoUlz1IZtCV5webhWyDdNquE X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201210/1609 X-Sequence-Number: 215845 On Mon, Oct 29, 2012 at 08:18:33AM -0400, Kevin Grittner wrote: > 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. +1. I had not considered this angle during previous reviews, but I agree with Andres's position. Since this patch does not strengthen the strongest tuple lock relative to its PostgreSQL 9.2 counterpart, that lock type should continue to use the syntax "FOR UPDATE". It will come to mean "the lock type sufficient for all possible UPDATEs of the row".