CREATE USER
CREATE USER — 定义一个新的数据库角色
语法
CREATE USER name [ [ WITH ] option [ ... ] ]
where option can be:
SUPERUSER | NOSUPERUSER
| CREATEDB | NOCREATEDB
| CREATEROLE | NOCREATEROLE
| INHERIT | NOINHERIT
| LOGIN | NOLOGIN
| REPLICATION | NOREPLICATION
| BYPASSRLS | NOBYPASSRLS
| CONNECTION LIMIT connlimit
| [ ENCRYPTED ] PASSWORD 'password' | PASSWORD NULL
| VALID UNTIL 'timestamp'
| IN ROLE role_name [, ...]
| IN GROUP role_name [, ...]
| ROLE role_name [, ...]
| ADMIN role_name [, ...]
| USER role_name [, ...]
| SYSID uid
描述
CREATE USER
现在是CREATE ROLE
的别名。唯一的区别是,当命令拼写为CREATE USER
时,默认情况下假定LOGIN
,而当命令拼写为CREATE ROLE
时,默认情况下假定NOLOGIN
。
兼容性
CREATE USER
语句是PostgreSQL扩展。SQL 标准将用户的定义留给实现。