PostgreSQL:角色明显存在但不存在?

3

我想整理我的PostgreSQL数据库中的角色,但我发现了一个我从未有意创建的角色。我猜这与托管数据库的Linux用户有关,但是当我尝试更改或删除该角色时,系统却奇怪地表示该用户不存在。

select * from pg_roles;
rolname    | rolsuper | rolinherit | rolcreaterole | rolcreatedb | rolcatupdate | rolcanlogin | rolreplication | rolconnlimit | rolpassword | rolvaliduntil | rolconfig |  oid
---------------+----------+------------+---------------+-------------+--------------+-------------+----------------+--------------+-------------+---------------+-----------+-------
postgreSQL    | t        | t          | t             | t           | t            | t           | f              |           -1 | ********    |               |           | 16387
postgres      | t        | t          | t             | t           | t            | t           | t              |           -1 | ********    |               |           |    10
standard_wimi | f        | t          | f             | f           | f            | f           | f              |           -1 | ********    |               |           | 17992 enter code here

所以,postgres是我的超级用户,而standard_wimi是我刚创建的角色。起初,我尝试删除postgreSQL角色,因为我似乎不需要它,因此我认为它不应该存在(具有这些特权)。但是任何删除或更改角色的尝试都会产生以下结果:

ALTER ROLE postgreSQL NOLOGIN;
ERROR:  role "postgresql" does not exist

请问有人能向我解释一下这种行为吗?角色从哪里来,为什么psql假装它不存在?

提前感谢!

1个回答

2

角色是区分大小写的,如果没有使用定界符的话,每个区分大小写的标识符都会被转换为小写字母。

ALTER ROLE "postgreSQL" NOLOGIN;

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接