C.5. User management

C.5.1. Does Shardman support global user roles?
C.5.2. How do I create a global user in Shardman?
C.5.3. How do I grant permissions to a global user?

C.5.1. Does Shardman support global user roles?

Yes, global user roles are supported.

C.5.2. How do I create a global user in Shardman?

postgres=# create role my_user with login password 'my_user123' in role global;
NOTICE:  user mapping for "my_user" does not exist for server "shardman_rg_2", skipping
NOTICE:  user mapping for "my_user" does not exist for server "shardman_rg_3", skipping
CREATE ROLE
    

C.5.3. How do I grant permissions to a global user?

The following commands can be run on one shard and will be cascaded to the other shards automatically:

GRANT\REVOKE
CREATE ROLE ... IN ROLE GLOBAL / ALTER ROLE (for global role) 
    
postgres=# grant CONNECT on DATABASE postgres TO my_user;
GRANT ROLE
postgres=# grant pg_monitor TO my_user;
GRANT ROLE
postgres=# \du
                                     List of roles
 Role name |                         Attributes                         |  Member of   
-----------+------------------------------------------------------------+--------------
 my_user   |                                                            | {pg_monitor}
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
 repluser  | Replication                                                | {}
    

The list of cascadable commands is being finalized and will be changed in future versions of Shardman.