Postgres 中的数据库 link 查看另一个本地主机图像:关系表名不存在

DB link in postgres looking at another localhost image : relation tablename does not exist

我正在使用 docker 来托管两个不同的 postgresql 实例,以尝试为 python 生成概念证明作为在两者之间移动数据的 etl 我可以通过以下方式连接到一个python 很好,但是当在第一个实例中调用过程时,它无法在第二个实例中找到 table 我使用此代码

使用 dblink 连接到第二个实例
FROM dblink('host=localhost port=5432 user=postgres password=postgres dbname=postgres','SELECT * FROM staging.test')

此错误消息是关系 staging.test 不存在

当使用多个 docker 图像并在每个图像上安装 postgresql 时让这些图像在连接字符串中的本地主机上相互通信时使用服务名称而不是本地主机

FROM dblink('host=ServiceName port=5432 user=postgres password=postgres dbname=postgres',
            'SELECT * FROM staging.test')