title: postgresql function error: column name does not exist
body: <p>i've implemented a function that check if a value appears in a specific row of a specific table:</p>
  
  <pre><code>CREATE FUNCTION check_if_if_exist(id INTEGER, table_name character(50), table_column character(20) ) RETURNS BOOLEAN AS $$
  
  DECLARE res BOOLEAN;
  
  BEGIN 
      SELECT table_column INTO res
      FROM table_name 
      WHERE table_column = id;
  
      RETURN res;
  END;
  
  $$ LANGUAGE plpgsql
  </code></pre>
  
  <p>i've create and fill a simple test table for try this function:</p>
  
  <pre><code>CREATE TABLE tab(f INTEGER);
  </code></pre>
  
  <p>and i call function like</p>
  
  <pre><code>SELECT check_if_exist(10, tab, f);
  </code></pre>
  
  <p>but i occurs in this error:</p>
  
  <pre><code>ERROR:  column "prova" does not exist
  LINE 1: SELECT check_if_exist(10, tab, f);
                                ^
  
  
  ********** Error **********
  
  ERROR: column "tab" does not exist
  SQL state: 42703
  Character: 27
  </code></pre>
  
  <p>why?</p>