title: Can't use the output of Redshift catalog queries
body: <p>I am having all kinds of problems working with queries against the Redshift catalog tables.</p>
  
  <p>To illustrate, the following works:</p>
  
  <pre><code>select "table_name"::text as "table"
  from "information_schema"."tables"
  where table_schema not like 'pg_%' and table_schema != 'information_schema'
  </code></pre>
  
  <p>and the following works:</p>
  
  <pre><code>create view works as 
  select "table_name"::text as "table"
  from "information_schema"."tables"
  where table_schema not like 'pg_%' and table_schema != 'information_schema'
  </code></pre>
  
  <p>But the following fails:</p>
  
  <pre><code>create table fails as
  select "table_name"::text as "table"
  from "information_schema"."tables"
  where table_schema not like 'pg_%' and table_schema != 'information_schema'
  </code></pre>
  
  <p>With:</p>
  
  <pre><code>[SQL]create table fails as
  select "table_name"::text as "table"
  from "information_schema"."tables"
  INFO:  Function "has_table_privilege(oid,text)" not supported.
  INFO:  Function "has_table_privilege(oid,text)" not supported.
  INFO:  Function "has_table_privilege(oid,text)" not supported.
  INFO:  Function "has_table_privilege(oid,text)" not supported.
  INFO:  Function "has_table_privilege(oid,text)" not supported.
  INFO:  Function "has_table_privilege(oid,text)" not supported.
  INFO:  Function "has_table_privilege(oid,text)" not supported.
  [Err] ERROR:  Specified types or functions (one per INFO message) not supported on Redshift tables.
  </code></pre>
  
  <p>From <a href="http://docs.aws.amazon.com/redshift/latest/dg/c_join_PG.html" rel="noreferrer">http://docs.aws.amazon.com/redshift/latest/dg/c_join_PG.html</a> I read </p>
  
  <p><code>If you write a join query that explicitly or implicitly references a column that has an unsupported data type, the query returns an error.</code></p>
  
  <p>Does this mean that in a create table based on a select against catalog tables (even though I cast the weird field types to text) that under the hood Redshift is doing joins and weird stuff which means I can't do this?</p>
  
  <p>Create table is one manifestation of the problem. Another is that I can't unload a view or anything based on a catalog query. E.g. the following will also fail with similar error messages to the above.</p>
  
  <pre><code>unload ('select * from "works"') to 's3://etc'
  </code></pre>
  
  <p>At the moment it seems the only way I can work with this data is to issue a query from an external program, and then have that external program write the resultset back manually to a table. i.e. it can't be done from within the database.</p>
  
  <p>Does anybody have another solution?</p>