我有一个自定义类型的数据库,由于CREATE FOREIGN TABLE
失败,无法使用IMPORT FOREIGN SCHEMA public FROM SERVER replica_db1 INTO db1
导入。 如何导入自定义类型? 此外,自定义类型是从公共架构引用的,如何将其更改为使用本地服务器的架构?
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...
谢谢
在使用以下命令导入架构之前,必须在服务器中创建数据类型"public.custom_type":
IMPORT FOREIGN SCHEMA public FROM SERVER replica_db1 INTO db1;