TEMPORAL JOINS do not work with range types
Created by: Piiit
The query
SELECT * FROM s RIGHT JOIN PERIOD WITH (t,t) r ON b=d;
gets rewritten into
(
WITH
temporal_join_x1 AS (SELECT *, t Us FROM s),
temporal_join_x2 AS (SELECT *, t Vs FROM r)
select *
from
(
SELECT *, coalesce(temporal_join_x1.t, temporal_join_x2.t) tts
FROM
(temporal_join_x1 ALIGN temporal_join_x2 ON b=d WITH (t,t))
RIGHT JOIN
(temporal_join_x2 ALIGN temporal_join_x1 ON b=d WITH (t,t))
ON b = d AND temporal_join_x1.t = temporal_join_x2.t
) inner_select
WHERE (lower(tts) = lower(Us) OR lower(tts) = lower(Vs))
AND (upper(tts) = upper(Us) OR upper(tts) = upper(Vs))
OR Us IS NULL
OR Vs IS NULL
) outer_select;