【发布时间】:2018-08-11 16:29:29
【问题描述】:
尝试使用以下查询获取表的元数据:
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.
我一直在尝试使用 info 架构视图,但发现最好使用 redshift 特定的 pg_... 视图来避免这些类型的错误,但它们仍在发生。
如何运行此查询而不出现这些错误?
【问题讨论】:
标签: metadata amazon-redshift pg