safer way to check for database existence

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2011-06-17 13:19:46 +02:00
parent 2cf67e321e
commit 2fcdf3825b

View file

@ -20,7 +20,7 @@
name="$__object_id"
if su - postgres -c "psql -l | grep -q '^ *$name'"; then
if su - postgres -c "echo '\q' | psql '$name'" 2>/dev/null; then
echo "present"
else
echo "absent"