pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Noah Misch <noah@leadboat.com>
Cc: Simon Riggs <simon@2ndQuadrant.com>
Cc: Kevin Grittner <kgrittn@mail.com>
Cc: Andres Freund <andres@2ndquadrant.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: foreign key locks
Date: Tue, 13 Nov 2012 19:07:30 -0300
Message-ID: <20121113220729.GA12811@alvh.no-ip.org> (raw)
In-Reply-To: <20121031210129.GD29247@tornado.leadboat.com>
References: <20121029121833.306930@gmx.com>
	<20121031193536.GA1651@tornado.leadboat.com>
	<CA+U5nMKK8oOcoxTtMO9ZgT6YYGYH2RQoDt15RXXyMh+Sp0tNmA@mail.gmail.com>
	<20121031202209.GF23139@alvh.no-ip.org>
	<20121031210129.GD29247@tornado.leadboat.com>

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 some
> > 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)
> 
> 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".  NON 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 privileges */
#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.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services




view thread (74+ messages)  latest in thread

Message-ID: <20121113220729.GA12811@alvh.no-ip.org>
Permalink:  ../20121113220729.GA12811@alvh.no-ip.org/
Also on:    postgresql.org/message-id/20121113220729.GA12811@alvh.no-ip.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@2ndquadrant.com, noah@leadboat.com, simon@2ndQuadrant.com, kgrittn@mail.com, andres@2ndquadrant.com
  Subject: Re: foreign key locks
  In-Reply-To: <20121113220729.GA12811@alvh.no-ip.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox