Re: LOCK for non-tables - Mailing list pgsql-hackers

From Tom Lane
Subject Re: LOCK for non-tables
Date
Msg-id 10015.1295034488@sss.pgh.pa.us
Whole thread Raw
In response to Re: LOCK for non-tables  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: LOCK for non-tables  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Fri, Jan 14, 2011 at 1:58 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> 2. Disallow the above abbreviated syntax; allow NOWAIT only after an
>> explicit IN ... MODE phrase. �This would probably break a couple of
>> applications, but I bet a lot fewer than changing the longer-established
>> parts of the command syntax would break.

> That strikes me as pretty unintuitive.  I'd rather take the hit of
> forcing people to write "LOCK TABLE foo" instead of just "LOCK foo"
> than try to explain why they have to include "IN ACCESS EXCLUSIVE
> MODE" if they want to stick "NOWAIT" on the end.  However, I guess
> it's a matter of opinion so... anyone else have an opinion?

It doesn't seem amazingly unintuitive to me; the syntax diagram just
changes from
LOCK ... [ IN lockmode MODE ] [ NOWAIT ]

to
LOCK ... [ IN lockmode MODE [ NOWAIT ] ]

If it had been that way to start with, nobody would have questioned it.

In any case I'd rather break apps using "LOCK foo NOWAIT" than break
every application using any form of LOCK at all, which is what I think
your proposal will amount to in practice.  People aren't that eager to
write useless noise words, which is what TABLE has been up to now in
this command.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [PATCH] Return command tag 'REPLACE X' for CREATE OR REPLACE statements.
Next
From: "Kevin Grittner"
Date:
Subject: Re: Database file copy