Syntax errors trying to create a user only if not exists in PostgreSQL
I'm trying to create a user in a PostgreSQL database only if it does not exist using the following: SELECT 'CREATE USER konguser WITH ENCRYPTED PASSWORD kongpassword' WHERE NOT EXISTS (SELECT FROM pg_user WHERE usename = 'kongdb')gexec ERROR: syntax error…