title: Table as an argument of a PostgreSQL function
body: <p>I'm trying to pass a table as an argument in a PostgreSQL function, and I can't find the right keyword (what should be instead of <code>table</code> in my code) in the first line :</p>
  
  <pre><code>CREATE FUNCTION test.fcttest(table)   
  RETURNS SETOF test.out_table
  AS $$
      INSERT INTO test.out_table /* obviously, the schema for this table is what it should be, an int column for A.id and a varchar(30) column for A.another_field */
          SELECT A.id, A.another_field
          FROM $1 A;
      SELECT A.id, A.another_field 
          FROM $1 A;
  $$ 
  LANGUAGE SQL;
  </code></pre>
  
  <p>Or maybe it just can't work like this ? If so, how should I do it ?</p>
  
  <p>(Also, I guess there might also be SQL injection related issues with my function, but please ignore them for now, it's for a prototype in a secure environment so I don't have to worry about it for the moment. Or if you do address it, please do so in a separate part of your answer so I can understand what adresses what :) ).</p>
  
  <p>Thanks.</p>