I wish to execute the next question if the database and consumer doesn’t exist.
CREATE DATABASE database;
CREATE ROLE consumer WITH LOGIN PASSWORD 'password';
REVOKE CONNECT ON DATABASE db1 FROM PUBLIC;
GRANT CONNECT ON DATABASE db1dev TO userbdev;
PostgreSQL doesn’t enable IF NOT EXSIST in CREATE DATABASE like MySQL does, so I wish to do the branching on the applying facet, is there a greater means?
Hello! There are three strategies to do it. After all you may put in and the consumer’s existence situation, and I’d keep away from this type of op between transaction statements.