Limiting the number of concurrent connections by a user

The same result can be achieved by setting the connection limit for that user to 0:

pguser=# alter user bob connection limit 0;
ALTER ROLE

To allow 10 concurrent connections for the bob user, run this command:

pguser=# alter user bob connection limit 10;
ALTER ROLE

To allow an unlimited number of connections for this user, run the following:

pguser=# alter user bob connection limit -1;
ALTER ROLE