JOIN on set returning function results
问题 I am trying to join table and function which returns rows: SELECT p.id, p.name, f.action, f.amount FROM person p JOIN calculate_payments(p.id) f(id, action, amount) ON (f.id = p.id); This function returns 0, 1 or more rows for each id. The query works on PostgreSQL 9.3, but on 9.1 it shows following error: ERROR: invalid reference to FROM-clause entry for table "p" HINT: There is an entry for table "p", but it cannot be referenced from this part of the query I cannot move out calculations