I need to create various schema in a database and give ownership of these to specific users. I want to do this in a script, and I rather not be the postgres user or a superuser. My user pat has createdb and createrole privileges.
pat=> create role toto with login password 'pass'; pat=> create schema toto; pat=> alter schema toto owner to toto; ERROR: must be member of role "toto"
Is there a way to do this without being postgres or superuser ? or should I give pat superuser privileges while running the scripts and drop it after? What is the best procedure?