title: How to select from variable that is a table name n Postgre >=9.2
body: <p>i have a variable that is a name of a table. How can i select or update from this using variable in query , for example:</p>
  
  <pre><code>create or replace function pg_temp.testtst ()
  returns varchar(255) as 
  $$
  declare 
  r record; t_name name;
  begin   
    for r in SELECT tablename FROM pg_tables WHERE schemaname = 'public' limit 100 loop
        t_name = r.tablename; 
        update  t_name set id = 10 where id = 15; 
    end loop; 
    return seq_name;
  end;
  $$
  language plpgsql; 
  </code></pre>
  
  <p>it shows
  <strong>ERROR:  relation "t_name" does not exist</strong></p>