OSDN Git Service

Cleanup --alldb option handling.
authorBruce Momjian <bruce@momjian.us>
Sat, 18 Dec 1999 08:46:44 +0000 (08:46 +0000)
committerBruce Momjian <bruce@momjian.us>
Sat, 18 Dec 1999 08:46:44 +0000 (08:46 +0000)
src/bin/scripts/vacuumdb

index 3261416..234a26b 100644 (file)
@@ -11,7 +11,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/bin/scripts/Attic/vacuumdb,v 1.6 1999/12/18 08:39:12 momjian Exp $
+#    $Header: /cvsroot/pgsql/src/bin/scripts/Attic/vacuumdb,v 1.7 1999/12/18 08:46:44 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -22,6 +22,7 @@ verbose=
 analyze=
 table=
 dbname=
+alldb=
 
 while [ $# -gt 0 ]
 do
@@ -86,7 +87,7 @@ do
                analyze="ANALYZE "
                ;;
        --alldb|-a)
-               dbname="`psql $PASSWDOPT $AUTHOPT $PGHOSTOPT $PGPORTOPT -q -t -A -d template1 -c 'SELECT datname FROM pg_database'`"
+               alldb=Y
                ;;
        --table|-t)
                table="$2"
@@ -132,6 +133,10 @@ if [ "$usage" ]; then
        exit 1
 fi
 
+if [ ! -z "$alldb" ]; then
+       dbname="`psql $PASSWDOPT $AUTHOPT $PGHOSTOPT $PGPORTOPT -q -t -A -d template1 -c 'SELECT datname FROM pg_database'`"
+fi
+
 if [ -z "$dbname" ]; then
        echo "$CMDNAME: Missing required argument database name. Try -? for help."
        exit 1