title: postgres doesn't recognize temp table in function
body: <p>This could be because i'm tired, or that I'm new to postgres. However, I'm trying to use a temp table in a function and postgres is complaining that the "relation does not exist". Yet, if I take the body of my function, and execute it it works just fine. Below is a sample of the type of function I'm trying to create. Keeping in mind I've stripped out everything interesting such that it's close to a bare minimum to show my problem. </p>
  
  <pre><code>CREATE OR REPLACE FUNCTION dbo.somefunc() RETURNS void AS
  $BODY$ 
  
  CREATE TEMPORARY TABLE work_list
  (
      name text,
      level smallint
  );
  
  insert into work_list
      (name, level)
  values
      ('someone', 25);
  
  $BODY$
  LANGUAGE sql VOLATILE;
  </code></pre>
  
  <p>The complaint I get is on the insert statement. The actual complaint is:</p>
  
  <pre><code>ERROR:  relation "work_list" does not exist
  </code></pre>
  
  <p>Does postgres not support temp tables in functions? Or is there some syntax thing that I'm missing that the thing is choking on and it's giving me a bogus error?</p>