「PostgreSQL」ロール(role)を追加する方法

環境
Windows 10 home 64bit
Postgresql 9.6.5

使用例
1.現在のロール一覧を確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
postgres=# select rolname from pg_roles;
rolname
-------------------
pg_signal_backend
postgres
cft055
postgres=# select rolname from pg_roles; rolname ------------------- pg_signal_backend postgres cft055
postgres=#  select rolname from pg_roles;
      rolname
-------------------
 pg_signal_backend
 postgres
 cft055

2.ロールを追加します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
postgres=# create role arkgame;
CREATE ROLE
postgres=# create role arkgame; CREATE ROLE
postgres=# create role arkgame;
CREATE ROLE

3.ロール追加後確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
postgres=# select rolname from pg_roles;
rolname
-------------------
pg_signal_backend
postgres
cft055
arkgame
postgres=# select rolname from pg_roles; rolname ------------------- pg_signal_backend postgres cft055 arkgame
postgres=# select rolname from pg_roles;
      rolname
-------------------
 pg_signal_backend
 postgres
 cft055
 arkgame

 

PostgreSQL

Posted by arkgame