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
1 changed files with 1 additions and 1 deletions

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"