2016-02-09 33 views
2

當我偶然發現一個我從未有意識創建的角色時,我想整理好postgreSQL數據庫中的角色。我認爲這與託管數據庫的Linux用戶有關,但奇怪的是,當我嘗試更改或刪除角色時,系統假裝用戶不存在。PostgreSQL:角色顯然存在但不存在?

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假裝它不存在?

提前致謝!

回答

2

角色區分大小寫,並且每個不區分大小寫的區分大小寫轉換爲小寫。

ALTER ROLE "postgreSQL" NOLOGIN; 
相關問題