I always find mysefl googling this when adding a new service that needs postgres to my PI.

CREATE DATABASE my_db;
CREATE USER my_user WITH PASSWORD '[password]'; 
GRANT CONNECT ON DATABASE my_db TO my_user;
ALTER DATABASE my_db OWNER TO my_user;