最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

PostgreSQL extension owners? - Stack Overflow

programmeradmin8浏览0评论

In PostgreSQL a database can have extensions, such as pg_trgm. Extensions have owners. When (in a Rails app) you try to load the schema, the extension has to be owned by the owner of the database.

I have one database engine with different database-owning roles, let's say role_A and role_G. They each own their own database, and each database inherits from template1.

For historical reasons, template1 already has the pg_trgm extension, and role_A is the extension owner when seen from within template1.

When role_G connects and does a CREATE DATABASE, it gets a database in which role_A is the owner of the pg_trgm extension.

Both databases need the extension, and both database will be dropped and recreated frequently, as Rails likes to do with test databases.

What approach will resolve this conflict? For example, can template1 be modified so that this extension is owned by a role that will resolve to the new owner of any newly-created database? something like PUBLIC ? What commands or queries or statements will accomplish this?

发布评论

评论列表(0)

  1. 暂无评论