Correlated references can be used in nested table expressions or as arguments to table functions.
The basic rule that applies for both these cases is that the correlated reference must be from a table-reference at a higher level in the hierarchy of subqueries.
This hierarchy includes the table-references that have already been resolved in the left-to-right processing of the FROM clause.
For nested table expressions, the LATERAL keyword must appear before the fullselect.
So the following examples are valid syntax: