amazon-redshift – 如何将pg_table_def表卸载到s3

我想转移红移模式并在不同环境之间进行一些比较.

unload('select * from pg_table_def') 
to 's3://blah/blah/stage.txt' 
credentials 'aws_access_key_id=XXXXX;aws_secret_access_key=XXXXXX' 
parallel off allowoverwrite manifest;

但上面的代码抛出了以下错误.

INFO:  Function "format_type(oid,integer)" not supported.
INFO:  Function "pg_table_is_visible(oid)" not supported.
ERROR:  Specified types or functions (one per INFO message) not supported on Redshift tables.

知道如何使这项工作?或者有任何其他方式来获得架构.我还需要知道排序键和dist键信息.

最佳答案 Redshift将某些信息保留在领导节点上的特殊区域中,而UNLOAD命令在每个切片(AFAIK)上处理,因此不能使用仅领导节点功能.

您可能需要使用psql从外部计算机中提取它.

点赞