Is the PostgreSQL 'connection limit' shared across all users in a role? I have created a role that many users can share:

&gt; create role foo_read_only connection limit 5;


I have then assigned permissions to that role:

&gt; grant select on table1 to foo_read_only;


Then I have assigned that role to people:

&gt; grant foo_read_only to fred;
&gt; grant foo_read_only to ginger;


Question: Do both fred and ginger get a connection limit of 5, or would that limit be shared between them?

Thanks!
The CONNECTION LIMIT attribute only affects roles that are able to log in (that is "users", or those roles which have the LOGIN attribute set).

Roles that are a member of another role with a CONNECTION LIMIT do not inherit that limit, so in the situation you describe above fred and ginger would have the default connection limit of -1 (unlimited).

To limit fred and ginger you would need to specifically set a CONNECTION LIMIT on those roles.