CREATE USER

Name

CREATE USER -- 定义一个新数据库角色

Synopsis

CREATE USER name [ [ WITH ] option [ ... ] ]

这里option可以是:
    
      SUPERUSER | NOSUPERUSER
    | CREATEDB | NOCREATEDB
    | CREATEROLE | NOCREATEROLE
    | CREATEUSER | NOCREATEUSER
    | INHERIT | NOINHERIT
    | LOGIN | NOLOGIN
    | CONNECTION LIMIT connlimit
    | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password'
    | 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标准把用户的定义交给了实现来完成。

又见

CREATE ROLE