データベース一覧の表示
\l
データベースの選択
\c データベース名
テーブル一覧の表示
\dt;
テーブル構造の表示
\d テーブル名;
現在のユーザー(Role)を表示
select current_user;
ユーザー(Role)の一覧を表示
\du
ユーザー情報一覧を表示
select * from pg_user;
ユーザー (Role)に権限を付与
grant select, insert, update, delete on <TABLE_NAME> to <USER_NAME>;
ユーザー (Role)に権限を剥奪
revoke select, insert, update, delete on <TABLE_NAME> from <USER_NAME>;
ユーザーの切り替え
\connect - <USER_NAME>
スーパーユーザーへ変更
alter role <USER_NAME> with creatural superuser;
スーパーユーザー権限剥奪
alter role <USER_NAME> with creatural nosuperuser;