Re: Left lateral join with for update and skip locked - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Left lateral join with for update and skip locked
Date
Msg-id 20150318131523.GU3636@alvh.no-ip.org
Whole thread Raw
In response to Left lateral join with for update and skip locked  (Benjamin Börngen-Schmidt<benjamin@boerngen-schmidt.de>)
List pgsql-hackers
Benjamin Börngen-Schmidt wrote:

> The Lateral statement does return a result, which I do not expect. I returns
> an end point multiple times for diverent start points. Why? I thought, that
> the selected point by the lateral is locked by the FOR UPDATE and if the
> lateral selects a point that is already locked it will be skipped by the
> SKIP LOCKED.

So you want the LATERAL to lock a row, such that that row is not
returned by the "s" arm of the left join in the same query because of
SKIP LOCKED?  That seems flawed to me: the row lock is considered
automatically granted if the would-be locker is the same transaction as
the lock holder.

I am too lazy to reverse engineer your schema.  Are de_sim_points_end
and de_sim_points_start views on the same table(s), or something like
that?

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



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Add LINE: hint when schemaname.typename is a non-existent schema
Next
From: Alvaro Herrera
Date:
Subject: Re: MD5 authentication needs help -SCRAM