The intent is an unconditional LEFT JOIN , which differs from CROSS JOIN in that all rows from the left table expression are returned, even if there are no matches in the right table expression, while CROSS JOIN discards such rows from the result. More about connections in the manual.
Nevertheless:
1=1 pointless in Postgres and all derivatives , including Amazon Redshift. Just use true . This was probably ported from another DBMS that does not properly support the boolean type.
... LEFT JOIN (SELECT ...) ue ON true
On the other hand, LEFT JOIN does not make sense for this particular subquery with SELECT MIN(modified) FROM user on the right, because SELECT with the aggregate function ( min() ) and without the GROUP BY always returns exactly one row. This case (but not other cases where a string cannot be found ) can be simplified to:
... CROSS JOIN (SELECT MIN(modified) AS first_modified FROM user) ue
Erwin brandstetter
source share