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

From Tom Lane
Subject Re: LOCK for non-tables
Date
Msg-id 10278.1295035552@sss.pgh.pa.us
Whole thread Raw
In response to Re: LOCK for non-tables  (Simon Riggs <simon@2ndQuadrant.com>)
Responses Re: LOCK for non-tables  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-hackers
Simon Riggs <simon@2ndQuadrant.com> writes:
> On Fri, 2011-01-14 at 14:48 -0500, Tom Lane wrote:
>> 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. 

> Can I suggest that we don't break anything at all?

> pg_lock_object(objectname, objecttype, mode);
> or
> pg_lock_sequence(name, mode);

> is all we need...

No, that will not work at all.  LOCK has to be a utility command.
A function called by SELECT isn't a substitute, because SELECT
will acquire a transaction snapshot before executing the function,
and that breaks many use cases for locks.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: SQL/MED - FDW API
Next
From: Bruce Momjian
Date:
Subject: Re: Database file copy