4

我有一个自定义类型的数据库,无法使用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...

谢谢

4

1 回答 1

3

在使用以下命令导入架构之前,您必须在服务器中创建数据类型“public.custom_type”:

IMPORT FOREIGN SCHEMA public FROM SERVER replica_db1 INTO db1;
于 2018-08-28T17:35:43.613 回答