I created a user:
createuser -U postgres foo
Then tried to create a database:
createdb -U foo foo createdb: database creation failed: ERROR: permission denied to create database
Oh yeah, I forgot to make a super user. Do I drop it and create it again:
dropuser -U postgres foo createuser -U postgres -s foo
Now I can create a database, right? Not so much:
createdb -U foo foo createdb: database creation failed: ERROR: permission denied to create database CONTEXT: Error message received from nodes: coordinator#2 coordinator#3 coordinator#4
Took me a while to realize that there were connections still around with the first "foo" user. I wiped them out:
psql -U postgres -c 'CLEAN CONNECTION TO ALL TO USER foo' CLEAN CONNECTION
And now I can create a database, right? Right:
createdb -U foo foo
So I think that when a user or role is dropped, any connections for that user should automatically be removed from the pool.