gpt4 book ai didi

PostgreSQL - 创建外表时如何导入自定义数据类型(使用 postgres-fdw)?

转载 作者:行者123 更新时间:2023-11-29 14:26:47 29 4
gpt4 key购买 nike

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

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

类型“public.custom_type”不存在

https://www.postgresql.org/docs/current/postgres-fdw.html中的相同

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

谢谢!

最佳答案

The documentation告诉你:

If the remote tables to be imported have columns of user-defined data types, the local server must have compatible types of the same names.

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

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

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

关于PostgreSQL - 创建外表时如何导入自定义数据类型(使用 postgres-fdw)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57000029/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com