简体   繁体   English

pg_restore 上的 PostgreSQL pg_upgrade 错误。 “角色‘29648’不存在”

[英]PostgreSQL pg_upgrade error on pg_restore. "role '29648' does not exist"

When using pg_upgrade to upgrade PostgreSQL from 11 to 13 I receive the below error in step "Restoring database schemas in the new cluster":当使用 pg_upgrade 将 PostgreSQL 从 11 升级到 13 时,我在步骤“在新集群中恢复数据库模式”中收到以下错误:

pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 3801; 0 0 ACL FUNCTION "pg_stat_statements_reset"() postgres
pg_restore: error: could not execute query: ERROR:  role "29648" does not exist

I can see pg_restore has already successfully restored other databases and all custom tables and constraints.我可以看到 pg_restore 已经成功恢复了其他数据库以及所有自定义表和约束。

After researching online I can see that other suggest using the pg_restore option "-x, --no-privileges" however I do not see a way of applying this to the pg_upgrade command.在线研究后,我可以看到其他建议使用 pg_restore 选项“-x,--no-privileges”但是我没有看到将其应用于 pg_upgrade 命令的方法。

I've tried to locate this role in origin to no avail using SELECT * FROM pg_roles;我尝试使用SELECT * FROM pg_roles;在 origin 中找到这个角色,但无济于事。 but I see no role with rolname or oid as "29648".但我认为 rolname 或 oid 没有作为“29648”的角色。

You somehow managed to corrupt your database: there are permissions on the function pg_stat_statements_reset() for a user that doesn't exist.您以某种方式设法破坏了您的数据库:对于不存在的用户,函数pg_stat_statements_reset()有权限。 You'll have to search your conscience or statement history for the cause.你将不得不搜索你的良心或陈述历史的原因。

The solution for this problem is simple, since the function belongs to an extension:这个问题的解决方案很简单,因为该函数属于一个扩展:

DROP EXTENSION pg_stat_statements;
CREATE EXTENSION pg_stat_statements;

Now the function will have the default permissions, and the upgrade should work without problems.现在该功能将具有默认权限,并且升级应该没有问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM