I have few CREATE user as part of myquery.sql files and it contains few other queries as well
my file looks like this
CREATE USER myuser NOLOGIN;
GRANT CONNECT on DATABSE myDataBase to myuser;
GRANT USAGE ON SCHEAMA myschema to myuser;
I have few queries like this in the same file, due to some reason I need to add new queries to same file, when execute the same file again I stuck with error user already exists, and does not reach to newly added query.
also I checked there is no IF NOT EXISTS kind of help for CREATE USER in postgres.
so how to add the check to create a USER only if not EXISTS.