title: How to pass a table or rows to a function in Postgresql?
body: <p>Here is the code, the current type of argument is array, but I want to pass a table or rows instead.</p>
  
  <pre><code>create or replace function skyband_sortedlist(rest point[]) 
      returns setof point
  as $$ 
  declare
  
      last_x integer :=0;
      last_y integer :=0;
  begin
      for ipoint in (select s0.x,s0.y from unnest(rest))
      loop 
          if ipoint.x&gt;last_x and ipoint.y&lt;&gt;last_y then
              last_x = ipoint.x;
              last_y = ipoint.y;
              return next;
          end if;
      end loop;
  end;
  $$ language plpgsql;
  </code></pre>