ユーザ用ツール

サイト用ツール


serverapps:db:postgresql:command

文書の過去の版を表示しています。


基本的なコマンド

データベース

データベース一覧の表示

\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;
serverapps/db/postgresql/command.1573176989.txt.gz · 最終更新: 2019/11/08 01:36 by hayashi