title: Postgres: variable saying from which schema I select
body: <p>I have created a SQL SELECT to get all enums and their values in a schema:</p>
  
  <pre><code>SELECT 
      t.typname, array_agg(e.enumlabel) 
  FROM pg_type t
  JOIN pg_enum e ON t.oid = e.enumtypid
  JOIN pg_namespace n ON t.typnamespace = n.oid
  WHERE t.typtype = 'e' AND n.nspname = 'public'
  GROUP BY typname
  </code></pre>
  
  <p>I have put the select into a view so I dont have to write it everytime I want to call it. The only thing that bothers me is that if I rename the schema or use it in another schema I have to rewrite the name of the schema manually, check line 6 of the code:</p>
  
  <pre><code>    WHERE t.typtype = 'e' AND n.nspname = 'public'
  </code></pre>
  
  <p>Public is hardtyped there. When selecting in postgres, is there a "global" variable saying from which schema you select? I was not able to find any.</p>
  
  <p>Thanks</p>
  
  <p>PS: I use postgres 8.4</p>