我有一个自定义模板数据库“template_custom”,其中包含一些表,由角色“suser”拥有。
现在我需要为角色“tenant1”创建一个新的数据库:
CREATE DATABASE db_tenant1 TEMPLATE template_custom OWNER tenant1;
数据库template_custom中的表(和序列)仍由suser拥有。所以:
\c db_tenant1 suser
REASSIGN OWNED BY suser TO tenant1;
现在,针对数据库 db_tenant1 一切正常。然而,模板数据库 "template_custom" 现在归属于 tenant1,并且所有表也是如此。这当然不是我想要的(也不是我期望的)。那么做这件事情的正确方法是什么?(使用 PostgreSQL 11.9)