【问题标题】:Dokku Postgres Import/Export issuesDokku Postgres 导入/导出问题
【发布时间】: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


    【解决方案1】:

    如果有人遇到这个问题,我可以通过运行 dokku postgres:connect dbname 并将 search_path 从 "$user", public 更改为 dbname, public 来连接到 postgres 实例。它现在有效。但是我觉得这不是最好的解决方案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-05-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多