我有一个自定义类型的数据库,由于IMPORT FOREIGN SCHEMA public FROM SERVER replica_db1 INTO db1
失败,因此无法使用CREATE FOREIGN TABLE
进行导入。如何导入自定义类型?另外,自定义类型是从公共架构中引用的,如何更改它以使用本地服务器中的架构?
reporting=> IMPORT FOREIGN SCHEMA public FROM SERVER replica_db1 INTO db1;
ERROR: type "public.custom_type" does not exist
LINE 8: start public.custom_type OPTIONS (column_name 'start'),
^
QUERY: CREATE FOREIGN TABLE table1 (
id bigint OPTIONS (column_name 'id') NOT NULL,
start public.custom_type OPTIONS (column_name 'start'),
"end" public.custom_type OPTIONS (column_name 'end')
) SERVER replica_db1
OPTIONS (schema_name 'public', table_name 'table1');
CONTEXT: importing foreign table "table1"
reporting=> IMPORT FOREIGN TYPE public FROM SERVER replica_db1 INTO db1;
ERROR: syntax error at or near "TYPE"
LINE 1: IMPORT FOREIGN TYPE public FROM SERVER replica_db1 INT...
谢谢
答案 0 :(得分:1)
在使用以下命令导入架构之前,必须在服务器中创建数据类型“ public.custom_type”:
IMPORT FOREIGN SCHEMA public FROM SERVER replica_db1 INTO db1;