createuser

createuserは、新しいユーザ(PostgreSQLにおけるロール)を作成する。

createuser
CentOS で PostgreSQL を使ってみよう!(2) | Let's Postgres

bg1@localhost ~]$ su
パスワード:
[root@localhost bg1]# service postgresql start
Redirecting to /bin/systemctl start postgresql.service
[root@localhost bg1]# su - postgres
[postgres@localhost ~]$ psql -l
                                         データベース一覧
   名前    |  所有者  | エンコーディング |  照合順序   | Ctype(変換演算子) |     アクセス権限      
-----------+----------+------------------+-------------+-------------------+-----------------------
 postgres  | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       |
 template0 | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | =c/postgres          +
           |          |                  |             |                   | postgres=CTc/postgres
 template1 | postgres | UTF8             | ja_JP.UTF-8 | ja_JP.UTF-8       | =c/postgres          +
           |          |                  |             |                   | postgres=CTc/postgres
(3 行)

[postgres@localhost ~]$ createuser testuser1
[postgres@localhost ~]$ psql
psql (11.7)
"help" でヘルプを表示します。

postgres=# \du
                                              ロール一覧
 ロール名  |                                    属性                                    | 所属グループ
-----------+----------------------------------------------------------------------------+--------------
 postgres  | スーパーユーザ, ロール作成可, DB作成可, レプリケーション可, RLS のバイパス | {}
 testuser1 |                                                                            | {}

postgres=#

ユーザを確認するのに、psqlで接続して、\duしてる。

作成済みのロール一覧を表示する | PostgreSQLの使い方

作成時に何も訊いてこない(昔はデフォルトで属性を訊いてきてた気が)せいか、testuser1に何の属性も付いてない・・・。