Database Security
By default, database security is turned off when you create a new database with PSQL v12. You turn it on by supplying a password for the Master user. See table Identifier Restrictions by Identifier Type for the restrictions pertaining to passwords.
Master User
Database security is based on the existence of a default user named Master who has full access to the database when security is turned on. By default, no password is set for the Master user. Security is enabled, or turned on, once you specify a password for the Master user.
The Master user can create groups and other users and define sets of data access permissions for these groups and users. You can add users and groups by executing SQL statements or by using PSQL Control Center (PCC).
The PUBLIC Special Group
If you want to grant the same permissions to all users, you can grant them to a special group named PUBLIC. The database engine automatically creates the special group PUBLIC when you turn on security. Initially, no permissions are assigned to PUBLIC.
PUBLIC is a special group because it provides default permissions for all users and groups. The database engine always checks permissions assigned to PUBLIC first. A couple of examples help clarify how PUBLIC permissions apply.
Suppose in PCC that you assign the CREATE TABLE permission to PUBLIC. You then create a user named myuser whose permissions in PCC do not include individual rights to create a table. Myuser can create a table because the database engine first checks default permissions in PUBLIC, and PUBLIC, in this case, grants rights to create a table.
Conversely, if a permission is not granted to PUBLIC, then the permission granted to the individual user or group applies. For example, suppose in PCC that you do not assign the CREATE TABLE permission to PUBLIC. No user can create a table unless the permissions for the user, or the group to which the user belongs, allow creating a table.
Users and Groups
After you turn on database security, you can then define groups and users. Nodes for Groups and Users appear in PSQL Explorer in PCC. See User and Group Tasks in PSQL User's Guide.
Restrictions