title: Define table and column names as arguments in a plpgsql function?
body: <p>It must be simple, but I'm making my first steps into Postgres functions and I can't find anything that works...</p>
  
  <p>I'd like to create a function that will modify a table and / or column and I can't find the right way of specifying my tables and columns as arguments in my function.</p>
  
  <p>Something like:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION foo(t table)
  RETURNS void AS $$
  BEGIN
     alter table t add column c1 varchar(20);
     alter table t add column c2 varchar(20);
     alter table t add column c3 varchar(20);
     alter table t add column c4 varchar(20);
  END;
  $$ LANGUAGE PLPGSQL;
  
  select foo(some_table)
  </code></pre>
  
  <p>In another case, I'd like to have a function that alters a certain column from a certain table:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION foo(t table, c column)
  RETURNS void AS $$
  BEGIN
     UPDATE t SET c = "This is a test";
  END;
  $$ LANGUAGE PLPGSQL;
  </code></pre>
  
  <p>Is it possible to do that?</p>