我有一个包含大量表的数据库。一些表归 postgres 用户所有,而不是我创建的。我想将此类表的所有权转移到我创建的表中,因为在执行 django-migrations 时,您只能为 psql 连接设置一个用户和密码,而该用户无权访问 postgres 用户拥有的表,因此迁移未完成。
到目前为止,谷歌搜索没有帮助,因为他们建议使用ALTER或REASSIGN OWNED 更改数据库或表的所有权。但问题是这些不能更改某些表的所有权,因为它们必须由postgres. 我可以通过逐个选择每个表来手动更改所有权,但是在尝试完全执行时,我收到一条错误消息
"ERROR: cannot reassign ownership of objects owned by role postgres because they are required by the database system".
手动更改一百多个表不是一种选择。有没有人对此问题有任何解决方法?