【发布时间】:2021-01-28 16:00:17
【问题描述】:
我使用dokku postgres:export dbname 导出了一个数据库,然后使用dokku postgres:import dbname 将其导入到另一个实例。在新实例上运行的应用程序未正确连接到新导入的数据库。它正在连接到数据库本身,但数据不存在。我进入连接到两个实例。运行\l 两者是相同的。但是,当我运行 \dt 时,区别就在于此。
实际结果
// On the new instance
=# \dt
List of relations
Schema | Name | Type | Owner
--------+------------------------+-------+----------
public | document | table | postgres
...
// On the original instance
=# \dt
List of relations
Schema | Name | Type | Owner
--------+------------------------+-------+----------
dbname | document | table | postgres
...
数据被移动了,但它是公共模式(我认为)。运行选择查询也会给我不同的结果。
// Original machine
SELECT * FROM document;
// Returns the data
SELECT * FROM dbname.document;
// Also returns the data
// New machine
SELECT * FROM document;
// Empty result
SELECT * FROM dbname.document;
// Returns the data
预期结果
我想我希望从一个数据库导出并导入到另一个具有相同名称的数据库会产生几乎相同的实例。这里的任何帮助都会很棒。该应用程序中的其他一切都运行良好,它连接到数据库,但不返回任何数据。
【问题讨论】:
标签: postgresql dokku