Fetching wrong results on comparing a variable with 0 in unix
You may consider something like:

#!/bin/bash
...
cnt=$(psql -h localhost -U postgres -d $DB_name -At -c "SELECT COUNT(*) AS USER_COUNT FROM pg_roles WHERE rolname = '${user}' ")

if [[ ${cnt} -eq 0 ]]
then
    echo 'New User ' $user
else
    echo 'User Exists ' $user
fi


The error you got saying unary operator expected is indeed because the variable is unset. There are various ways to handle that, but in this case, I think it should be fine