Temporal normalizer: subquery produces null values on the right argument of "join"...
Created by: Piiit
What should we do in this case? Currently I just say to the executor to stop, i.e. return null... But this rejects the last result row...
select *
from
(
select row_number() over (), * from r01
) r01
left outer join
(
select s01.*, ts P1 from s01
union all
select s01.*, te P1 from s01
) s01
on r01.b=s01.d and p1 >= r01.ts and p1 < r01.te
order by row_number, P1;
gives
row_number | a | b | ts | te | c | d | ts | te | p1
------------+---+---+----+----+---+---+----+----+----
1 | a | B | 1 | 7 | 1 | B | 2 | 5 | 2
1 | a | B | 1 | 7 | 2 | B | 3 | 4 | 3
1 | a | B | 1 | 7 | 2 | B | 3 | 4 | 4
1 | a | B | 1 | 7 | 1 | B | 2 | 5 | 5
2 | b | B | 3 | 9 | 2 | B | 3 | 4 | 3
2 | b | B | 3 | 9 | 2 | B | 3 | 4 | 4
2 | b | B | 3 | 9 | 1 | B | 2 | 5 | 5
2 | b | B | 3 | 9 | 3 | B | 7 | 9 | 7
3 | c | G | 8 | 10 | | | | |
(9 rows)