title: Postgresql say “schema does not exist”
body: <p>How can I make this query works?</p>
  
  <p>I've the function <code>top_movies_ceiling(3)</code></p>
  
  <pre><code>CREATE OR REPLACE FUNCTION top_movies_ceiling(n_top integer)  -- n_top dos mais vendidos
  RETURNS SETOF inventory AS $$
  BEGIN
  RETURN QUERY
  SELECT *
  FROM inventory
  ORDER BY sales DESC
  LIMIT n_top;
  END;
  $$LANGUAGE plpgsql; 
  </code></pre>
  
  <p>that returns:</p>
  
  <pre><code>prod_id|quan_in_stock|sales
  </code></pre>
  
  <p>Now, when I run the query:</p>
  
  <pre><code>SELECT products.price 
  FROM products
  WHERE products.prod_id = prod_id.top_movies_ceiling(3);
  </code></pre>
  
  <p>I get the error: <code>schema "prod_id" does not exist</code></p>
  
  <p>I hope that you can help me!
  Thanks!</p>