Lee*_*Lee 2 information-schema errors catalogs system-tables redshift
我收到了另一个团队发来的列名列表。为了确保所有字段列名称在特定模式内有效,我将它们放入临时表中。我现在想看看它们是否存在。当我尝试加入 时information_schema.columns
,我收到以下错误:
ERROR: 0A000: Specified types or functions (one per INFO message) not supported on Redshift tables.
Column "c.column_name" has unsupported type "information_schema.sql_identifier".
Column "a.*" has unsupported type "pg_attribute".
Column "t.*" has unsupported type "pg_type".
Function "format_type(oid,integer)" not supported.
Function "format_type(oid,integer)" not supported.
Function "has_table_privilege(oid,text)" not supported.
Function "has_table_privilege(oid,text)" not supported.
Function "has_table_privilege(oid,text)" not supported.
Function "has_table_privilege(oid,text)" not supported.
Run Code Online (Sandbox Code Playgroud)
我尝试过塑造column_name
不同的类型,但没有成功。有人可以告诉我出了什么问题以及我如何实现这个目标吗?
PG_TABLE_DEF
INFORMATION_SCHEMA.COLUMNS
Amazon 考虑使用仅限 Leader-Node 函数的内部函数。亚马逊并没有明智地重新定义标准化INFORMATION_SCHEMA.COLUMNS
,而是试图定义自己的专有版本。为此,他们提供了另一个PG_TABLE_DEF
似乎可以满足相同需求的功能。请注意中心有关将架构添加到 的注释search_path
。
存储有关表列的信息。
PG_TABLE_DEF
只返回有关用户可见的表的信息。如果PG_TABLE_DEF
未返回预期结果,请验证 search_path 参数是否设置正确以包含相关架构。您可以用来
SVV_TABLE_INFO
查看有关表的更全面的信息,包括数据分布偏差、键分布偏差、表大小和统计信息。
因此,使用您的示例代码(NOT EXISTS
为了清楚起见而重写),
SET SEARCH_PATH to '$user', 'public', 'target_schema';
SELECT "column"
FROM dev.fields f
WHERE NOT EXISTS (
SELECT 1
FROM PG_TABLE_DEF pgtd
WHERE pgtd.column = f.field
AND schemaname = 'target_schema'
);
Run Code Online (Sandbox Code Playgroud)
也可以看看,
归档时间: |
|
查看次数: |
9153 次 |
最近记录: |