title: Using stored procedure returning SETOF record in LEFT OUTER JOIN
body: <p>I'm trying to call a stored procedure passing parameters in a left outer join like this:</p>
  
  <pre><code>select i.name,sp.*
  from items i
  left join compute_prices(i.id,current_date) as sp(price numeric(15,2), 
            discount numeric(5,2), taxes numeric(5,2)) on 1=1
  where i.type = 404;
  </code></pre>
  
  <p><code>compute_prices()</code> returns a setof record.<br>
  This is the message postgres shows:</p>
  
  <blockquote>
    <p>ERROR:  invalid reference to FROM-clause entry for table "i"</p>
    
    <p>...left join compute_prices(<strong><em>i.id</em></strong>,current_date)...</p>
    
    <p>HINT:  There is an entry for table "i", but it cannot be referenced
    from this part of the query.</p>
  </blockquote>
  
  <p>This kind of query works in Firebird. Is there a way I could make it work by just using a query? I don't want to create another stored procedure that cycles through items and makes separate calls to <code>compute_prices()</code>.</p>