Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TYOdu-0008Cr-Hs for pgsql-hackers@postgresql.org; Tue, 13 Nov 2012 22:07:38 +0000 Received: from smtprelay0234.b.hostedemail.com ([64.98.42.234] helo=smtprelay.b.hostedemail.com) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TYOdr-0006Ar-Pa for pgsql-hackers@postgresql.org; Tue, 13 Nov 2012 22:07:37 +0000 Received: from filter.hostedemail.com (b-bigip1 [10.5.19.254]) by smtprelay02.b.hostedemail.com (Postfix) with SMTP id 2BC15B9EB7; Tue, 13 Nov 2012 22:07:33 +0000 (UTC) X-Panda: scanned! X-Spam-Summary: 40, 2.5, 0, , d41d8cd98f00b204, alvherre@alvh.no-ip.org, :::::::::, RULES_HIT:355:379:599:601:945:967:973:988:989:1260:1277:1311:1312:1313:1314:1345:1358:1359:1437:1515:1516:1518:1519:1534:1541:1593:1594:1595:1596:1711:1730:1747:1777:1792:2194:2199:2379:2393:2525:2553:2560:2563:2682:2685:2828:2859:2895:2933:2937:2939:2942:2945:2947:2951:2954:3022:3027:3138:3139:3140:3141:3142:3353:3636:3865:3866:3867:3868:3869:3870:3871:3872:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4605:4659:5007:6119:6261:7679:7809:8660:8784:9025:9108:9121:9149:10011:10400:10848:11256:11257:11473:11658:11914:12438:12517:12519:12740, 0, RBL:none, CacheIP:none, Bayesian:0.5, 0.5, 0.5, Netcheck:none, DomainCache:0, MSF:not bulk, SPF:fn, MSBL:0, DNSBL:none, Custom_rules:0:1:0 X-Session-Marker: 616C76686572726540616C76682E6E6F2D69702E6F7267 X-Filterd-Recvd-Size: 2727 Received: from perhan.alvh.no-ip.org (unknown [200.85.208.156]) (Authenticated sender: alvherre@alvh.no-ip.org) by omf11.b.hostedemail.com (Postfix) with ESMTPA; Tue, 13 Nov 2012 22:07:32 +0000 (UTC) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 815546E030; Tue, 13 Nov 2012 19:07:30 -0300 (CLST) Date: Tue, 13 Nov 2012 19:07:30 -0300 From: Alvaro Herrera To: Noah Misch Cc: Simon Riggs , Kevin Grittner , Andres Freund , pgsql-hackers@postgresql.org Subject: Re: foreign key locks Message-ID: <20121113220729.GA12811@alvh.no-ip.org> References: <20121029121833.306930@gmx.com> <20121031193536.GA1651@tornado.leadboat.com> <20121031202209.GF23139@alvh.no-ip.org> <20121031210129.GD29247@tornado.leadboat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20121031210129.GD29247@tornado.leadboat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: 0.3 (/) X-Archive-Number: 201211/586 X-Sequence-Number: 216438 Noah Misch wrote: > On Wed, Oct 31, 2012 at 05:22:10PM -0300, Alvaro Herrera wrote: > > Not really sure about the proposed syntax, but yes clearly we need so= me > > other syntax to mean "FOR NON KEY UPDATE". I would rather keep FOR > > UPDATE to mean what I currently call FOR KEY UPDATE. More proposals = for > > the other (weaker) lock level welcome (but if you love FOR NON KEY > > UPDATE, please chime in too) >=20 > Agree on having "FOR UPDATE" without any "FOR KEY UPDATE" synonym. For= the > weaker lock, I mildly preferred the proposal of "FOR NO KEY UPDATE". N= ON KEY > captures the idea better in English, but NO is close enough and already= part > of the SQL lexicon. This is the proposal I like best; however there is an asymmetry, because the locking options now are FOR KEY SHARE FOR SHARE FOR NO KEY UPDATE FOR UPDATE I used to have comments such as /* Currently, SELECT ... FOR [KEY] UPDATE/SHARE requires UPDATE privilege= s */ #define ACL_SELECT_FOR_UPDATE ACL_UPDATE but now they are slightly incorrect because the NO is not illustrated. I guess I could use SELECT ... FOR [NO KEY] UPDATE/SHARE but this leaves out the "FOR KEY SHARE" case (and can be thought to introduce a FOR NO KEY SHARE case). And getting much more verbose than that is probably not warranted. In some places I would like the use a phrase like "the locking clause", but I'm not sure that it's clear enough. --=20 =C1lvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services