错误:Redshift表不支持指定的类型或功能(每个INFO消息一个)

时间:2018-08-11 16:29:30

标签: metadata amazon-redshift pg

尝试通过以下查询获取表中的元数据:

SET SEARCH_PATH to '$user', 'public', 'myschema';
select schemaname,tablename, col, typ, nn, row_number()
OVER(PARTITION BY col, typ, nn) As row
from 
(
SELECT n.nspname::text AS schemaname, c.relname::text AS tablename, 
a.attname::text AS col, format_type(a.atttypid, a.atttypmod)::text AS typ, 
format_encoding(a.attencodingtype::integer)::text AS "encoding", 
a.attisdistkey AS "distkey", a.attsortkeyord AS "sortkey", a.attnotnull AS nn
  FROM pg_namespace n, pg_class c, pg_attribute a
  WHERE n.oid = c.relnamespace AND c.oid = a.attrelid AND a.attnum > 0 AND NOT a.attisdropped AND pg_table_is_visible(c.oid)
  ORDER BY n.nspname, c.relname, a.attnum
) tt
where schemaname = 'myschema' and tablename like 'tbl\\_%';

但是我遇到了错误:ERROR: Specified types or functions (one per INFO message) not supported on Redshift tables.

我一直在尝试使用信息架构视图,但发现最好使用特定于redshift的pg_...视图来避免这些类型的错误,但是它们仍然在发生。

如何在不出现这些错误的情况下运行此查询?

1 个答案:

答案 0 :(得分:0)

请查看内置视图svv_table_info,以获取此信息。

您可能还对我们在GitHub的Utils中发布的“ Admin Views”感兴趣。