Re: SKIP LOCKED DATA (work in progress) - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: SKIP LOCKED DATA (work in progress)
Date
Msg-id 20140804160244.GH5475@eldon.alvh.no-ip.org
Whole thread Raw
In response to Re: SKIP LOCKED DATA (work in progress)  (David Rowley <dgrowleyml@gmail.com>)
List pgsql-hackers
David Rowley wrote:

> The only notes I can think to leave for the commiter would be around the
> precedence order of the lock policy, especially around a query such as:
> 
> SELECT * FROM (SELECT * FROM a FOR UPDATE SKIP LOCKED) a FOR UPDATE; --
> skip locked wins
> 
> Of course the current behaviour is that NOWAIT wins over the standard FOR
> UPDATE, but with NOWAIT, there's only a chance of an error, there's no
> chance of giving incorrect results.

Another option is to throw an error at parse analysis time if there is a
conflict in the specified locking policies, as in the above case.  Are
there cases in which it would make sense to have one clause trump the
other?  It seems reasonable to have NOWAIT trump regular FOR UPDATE (as
it already does), since, as you say, there's chance of error being
thrown at runtime, but not of incorrect result.

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



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: pg_upgrade autovacuum_multixact_freeze_max_age fix
Next
From: Claudio Freire
Date:
Subject: Re: Proposal: Incremental Backup