Browse code

- make postgres drop database behaviour more error tolerant - try to continue, even if the deletion of the user fails, this happens if some other database depends on them - output a warning in this case

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3772 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt authored on 27/02/2008 15:37:40
Showing 1 changed files
... ...
@@ -79,13 +79,21 @@ if [ $# -ne 1 ] ; then
79 79
 	exit 1
80 80
 fi
81 81
 
82
-# postgresql users are not dropped automatically
83
-sql_query "template1" "drop database \"$1\"; drop user \"$DBRWUSER\"; drop user \"$DBROUSER\";"
84
-
82
+sql_query "template1" "drop database \"$1\";"
85 83
 if [ $? -ne 0 ] ; then
86 84
 	merr "Dropping database $1 failed!"
87 85
 	exit 1
88 86
 fi
87
+
88
+# postgresql users are not dropped automatically
89
+sql_query "template1" "drop user \"$DBRWUSER\"; drop user \"$DBROUSER\";"
90
+
91
+if [ $? -ne 0 ] ; then
92
+	mwarn "Could not drop $DBRWUSER or $DBROUSER users, try to continue.."
93
+else 
94
+	minfo "Database user deleted"
95
+fi
96
+
89 97
 minfo "Database $1 dropped"
90 98
 } #openser_drop
91 99