【发布时间】:2023-01-23 01:47:23
【问题描述】:
无法以非超级用户身份在公共模式中创建表
postgres - 超级用户。
我做了什么:
ALTER SCHEMA public owner to postgres;
CREATE USER admin WITH PASSWORD 'my-password';
GRANT USAGE, CREATE ON SCHEMA public TO postgres;
GRANT USAGE, CREATE ON SCHEMA public TO admin;
CREATE DATABASE mydb;
GRANT ALL ON DATABASE mydb TO admin;
特权:
postgres=# \dn+
List of schemas
Name | Owner | Access privileges | Description
--------+----------+----------------------+------------------------
public | postgres | postgres=UC/postgres+| standard public schema
| | =UC/postgres +|
| | admin=UC/postgres |
(1 row)
我得到了什么:
如何在公共模式中创建表?...
新潮
【问题讨论】:
-
postgresql.org/about/news/postgresql-15-released-2526
PostgreSQL 15 also revokes the CREATE permission from all users except a database owner from the public (or default) schema -
“postgres”所有者数据库。 “postgres”所有者模式“公共”。 \dn+ 显示管理员可以完全访问架构,但这对我不起作用。
标签: sql postgresql debian postgresql-15