【发布时间】:2022-08-18 07:15:53
【问题描述】:
我们有一个现有的 heroku 应用程序,我们有时会 pg:backups restore 到其他应用程序。
自 8 月 1 日起恢复失败 (https://devcenter.heroku.com/changelog-items/2446)
现有应用在public 中有扩展名,新创建的应用在heroku_ext 中有扩展名。所以我想把扩展移到heroku_ext
some-app::DATABASE=> alter extension hstore set schema heroku_ext;
ERROR: permission denied for schema heroku_ext
架构:
some-app::DATABASE=> \\dn
List of schemas
Name | Owner
------------+----------------
heroku_ext | postgres
public | some-user
扩展(为简洁起见,仅显示一个)
some-app::DATABASE=> \\dx
List of installed extensions
Name | Version | Schema | Description
--------------------+---------+------------+------------------------------------------------------------------------
hstore | 1.7 | public | data type for storing sets of (key, value) pairs
我无法删除/重新创建扩展,因为有 hstore 列取决于它。如何更改扩展的架构?
更新:
与heroku取得联系,他们说他们正在解决这个问题并提供以下信息作为解决方法:
通过以下方式手动迁移 Postgres 插件:
将受影响的数据库拉入本地数据库手动迁移 在应用程序上本地创建新数据库的相关扩展 将带有迁移扩展的本地数据库推送到新数据库中 推广新数据库手动更新模式引用。为了 例子:
更改 WITH SCHEMA public 的所有实例;与架构 heroku_ext;和所有实例: DEFAULT public to DEFAULT heroku_ext 通过在文本编辑器中使用查找和替换或更改 使用 sed 的 pg_dump
-
permission denied for schema heroku_ext- 如果您要尝试这个,您需要能够在该模式中创建对象。您还需要成为扩展的所有者,并且(我认为)只有一些扩展支持在安装后更改其架构。 -
谢谢@RichardHuxton hstore 是可重定位的,我可以将它移动到本地 PG 安装上的新模式。这更像是一个 heroku 问题,我会说因为他们引入了这个限制,即必须将扩展安装到 NEW 应用程序的 \"heroku_ext\" 架构中。所以我们不能复制数据库。
-
Heroku 的回答令人失望☹️,因为这会在本地操作时引入额外的停机时间,因此需要启动和下载。也很容易出错。希望他们能解决这个问题。
-
是的,令人失望。他们没有考虑到所有用例。特别是因为某些扩展是不可重定位的。
标签: postgresql heroku