Why did PostgreSQL merge users and groups into roles?

后端 未结 4 869
一个人的身影
一个人的身影 2020-12-14 02:42

From the PostgreSQL docs:

The concept of roles subsumes the concepts of \"users\" and \"groups\". In PostgreSQL versions before 8.1, users and group

4条回答
  •  隐瞒了意图╮
    2020-12-14 02:57

    The merge has many advantages and no disadvantages. For instance, you can now seamlessly convert a "user" to a "group" and vice versa by adding / removing the LOGIN privilege.

    ALTER ROLE myrole LOGIN;
    ALTER ROLE myrole NOLOGIN;
    

    Or you can GRANT membership in any other login ("user") or non-login role ("group") to a role:

    GRANT joe TO sue;
    

    You can still:

    CREATE USER james;
    

    That's just a role with login privilege now. Or:

    CREATE GROUP workers;
    

    That's effectively the same as CREATE ROLE now.

    The manual has it all.

提交回复
热议问题