I want to write an IF Condition in PostgresQL which will CREATE a new ROLE in the DB, but should work in such a way that.
I first check in an IF statement if the existing user has the privilege to CREATE a new ROLE and if the user has the privilege only then execute the CREATE ROLE statement.
Something like
IF ( Current user has privilege to create new ROLE ) THEN
CREATE ROLE rolename;
end if;
Can this be done?