【问题标题】:PostgreSQL - How to import custom data type when creating foreign table (using postgres-fdw)?PostgreSQL - 创建外部表时如何导入自定义数据类型(使用 postgres-fdw)?
【发布时间】:2019-07-12 04:01:40
【问题描述】:

我正在尝试使用postgresql_fdw (https://www.postgresql.org/docs/current/postgres-fdw.html) 创建外部表视图。

当尝试IMPORT FOREIGN SCHEMA public FROM SERVER replica_db1 INTO db1时,它会报告

type "public.custom_type" does not exist

https://www.postgresql.org/docs/current/postgres-fdw.html

我想知道,如何自动将自定义数据类型复制到目标数据库中?

谢谢!

【问题讨论】:

    标签: postgresql custom-data-type postgres-fdw


    【解决方案1】:

    The documentation告诉你:

    如果要导入的远程表有自定义数据类型的列,本地服务器必须有兼容的同名类型。

    所以要确保本地数据库有一个同名的类型,并且最好也是相似的(至少具有相同的文本表示)。

    如果您希望将该类型的函数和运算符下推,则必须将它们放入您在两个数据库中安装的extension

    然后在外部服务器的extension 选项中指定该扩展名。

    【讨论】:

      猜你喜欢
      • 2019-07-01
      • 2020-07-20
      • 1970-01-01
      • 2012-11-19
      • 2017-10-07
      • 1970-01-01
      • 2017-11-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多