This page in other versions: Unsupported versions: 7.0

User Names and Groups

To define a new user, run the createuser utility program.

To assign a user or set of users to a new group, one must define the group itself, and assign users to that group. In Postgres these steps are not currently supported with a create group command. Instead, the groups are defined by inserting appropriate values into the pg_group system table, and then using the grant command to assign privileges to the group.

Creating Users

Creating Groups

Currently, there is no easy interface to set up user groups. You have to explicitly insert/update the pg_group table. For example:

jolly=> insert into pg_group (groname, grosysid, grolist)
jolly=>     values ('posthackers', '1234', '{5443, 8261}');
INSERT 548224
jolly=> grant insert on foo to group posthackers;
CHANGE
jolly=>
     

The fields in pg_group are:

groname

The group name. This a name and should be purely alphanumeric. Do not include underscores or other punctuation.

grosysid

The group id. This is an int4. This should be unique for each group.

grolist

The list of pg_user id's that belong in the group. This is an int4[].

Assigning Users to Groups

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group