Table functions and visibility rules
If you use both explicit and implicit join syntax, the query can
result in an error because of visibility rules. For example, the following
query results in an error:
select * from feeder, feeder2, feeder3 left join
table(tfunc(feeder.i, feeder2.i)) on 1=1 where feeder.i =
feeder2.i;The error occurs because the tfunc table function
is in an explicit join clause that has visibility only of feeder3
and is laterally correlated with feeder and feeder2. In this case,
you can specify only the tables that appear in the left of the join
expression, or constants, as arguments to the table function. Also,
the left join is not a table function lateral correlation, but a standard
left join because feeder3 does not appear as a table function argument.
The correct way to construct such a query is as follows:
select * from feeder3 left join (feeder join feeder2 on feeder.i =
feeder2.i join table(tfunc(feeder.i, feeder2.i)) on 1=1) on 1=1;