Роль creator

=> CREATE ROLE creator WITH CREATEDB CREATEROLE;
CREATE ROLE

Роль weak

=> CREATE ROLE weak WITH LOGIN;
CREATE ROLE

Проверка возможности создания БД

=> \c - weak
You are now connected to database "postgres" as user "weak".
=> CREATE DATABASE access_roles;
ERROR:  permission denied to create database

Включение в группу

=> \c - postgres
You are now connected to database "postgres" as user "postgres".
=> GRANT creator TO weak;
GRANT ROLE

Создание БД

=> \c - weak
You are now connected to database "postgres" as user "weak".
=> SET ROLE creator;
SET
=> CREATE DATABASE access_roles;
CREATE DATABASE