PostgreSQL:角色明明存在却不存在?
PostgreSQL: Role clearly exists but does not exist?
我想整理我的 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 假装它不存在?
提前致谢!
角色区分大小写,每个未定界的区分大小写的标识符都转换为小写。
ALTER ROLE "postgreSQL" NOLOGIN;
我想整理我的 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 假装它不存在?
提前致谢!
角色区分大小写,每个未定界的区分大小写的标识符都转换为小写。
ALTER ROLE "postgreSQL" NOLOGIN;