Re: LOCK for non-tables

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tatsuo Ishii <ishii(at)postgresql(dot)org>, fgp(at)phlo(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: LOCK for non-tables
Date: 2011-01-14 20:05:52
Message-ID: 10278.1295035552@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Simon Riggs <simon(at)2ndQuadrant(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2011-01-14 20:11:29 Re: Database file copy
Previous Message Andrew Dunstan 2011-01-14 19:59:00 Re: SQL/MED - FDW API