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