head	1.29;
access;
symbols
	REL7_3_21:1.26
	REL7_3_20:1.26
	REL7_3_19:1.26
	REL7_3_18:1.26
	REL7_3_17:1.26
	REL7_3_16:1.26
	REL7_3_15:1.26
	REL7_3_14:1.26
	REL7_3_13:1.26
	REL7_3_12:1.26
	REL7_3_11:1.26
	REL7_2_8:1.19
	REL7_3_10:1.26
	REL7_2_7:1.19
	REL7_3_9:1.26
	REL7_3_8:1.26
	REL7_2_6:1.19
	REL7_2_5:1.19
	REL7_3_7:1.26
	REL7_3_6:1.26
	REL7_3_5:1.26
	REL7_3_4:1.26
	REL7_3_2:1.26
	REL7_2_4:1.19
	REL7_3_STABLE:1.26.0.2
	REL7_2_3:1.19
	REL7_2_STABLE:1.19.0.2
	REL7_2:1.19
	REL7_2_RC2:1.19
	REL7_2_RC1:1.19
	REL7_2_BETA5:1.19
	REL7_2_BETA4:1.19
	REL7_2_BETA3:1.19
	REL7_2_BETA2:1.19
	REL7_2_BETA1:1.19
	REL7_1_2:1.16
	REL7_1_STABLE:1.16.0.2
	REL7_1_BETA:1.13
	REL7_1_BETA3:1.15
	REL7_1_BETA2:1.13
	REL7_1:1.16
	REL7_0_PATCHES:1.9.0.2
	REL7_0:1.9;
locks; strict;
comment	@# @;


1.29
date	2003.06.18.12.19.11;	author petere;	state dead;
branches;
next	1.28;

1.28
date	2003.06.11.05.13.12;	author momjian;	state Exp;
branches;
next	1.27;

1.27
date	2003.05.14.03.26.03;	author tgl;	state Exp;
branches;
next	1.26;

1.26
date	2002.10.18.22.05.36;	author petere;	state Exp;
branches;
next	1.25;

1.25
date	2002.10.16.03.44.28;	author momjian;	state Exp;
branches;
next	1.24;

1.24
date	2002.10.16.03.24.09;	author momjian;	state Exp;
branches;
next	1.23;

1.23
date	2002.08.10.16.57.32;	author petere;	state Exp;
branches;
next	1.22;

1.22
date	2002.06.20.20.29.42;	author momjian;	state Exp;
branches;
next	1.21;

1.21
date	2002.04.12.09.37.11;	author momjian;	state Exp;
branches;
next	1.20;

1.20
date	2002.02.18.05.48.45;	author momjian;	state Exp;
branches;
next	1.19;

1.19
date	2001.09.30.22.17.51;	author momjian;	state Exp;
branches;
next	1.18;

1.18
date	2001.09.22.04.28.12;	author momjian;	state Exp;
branches;
next	1.17;

1.17
date	2001.07.10.22.09.29;	author tgl;	state Exp;
branches;
next	1.16;

1.16
date	2001.02.18.18.34.02;	author momjian;	state Exp;
branches;
next	1.15;

1.15
date	2001.01.08.23.02.36;	author tgl;	state Exp;
branches;
next	1.14;

1.14
date	2001.01.08.20.32.27;	author tgl;	state Exp;
branches;
next	1.13;

1.13
date	2000.11.25.19.05.44;	author petere;	state Exp;
branches;
next	1.12;

1.12
date	2000.11.13.23.37.53;	author momjian;	state Exp;
branches;
next	1.11;

1.11
date	2000.11.13.15.18.14;	author momjian;	state Exp;
branches;
next	1.10;

1.10
date	2000.11.11.22.59.48;	author petere;	state Exp;
branches;
next	1.9;

1.9
date	2000.01.19.20.08.36;	author petere;	state Exp;
branches;
next	1.8;

1.8
date	2000.01.12.19.36.36;	author petere;	state Exp;
branches;
next	1.7;

1.7
date	99.12.18.08.46.44;	author momjian;	state Exp;
branches;
next	1.6;

1.6
date	99.12.18.08.39.12;	author momjian;	state Exp;
branches;
next	1.5;

1.5
date	99.12.18.08.34.50;	author momjian;	state Exp;
branches;
next	1.4;

1.4
date	99.12.16.20.10.02;	author momjian;	state Exp;
branches;
next	1.3;

1.3
date	99.12.07.22.41.44;	author momjian;	state Exp;
branches;
next	1.2;

1.2
date	99.12.05.20.02.49;	author momjian;	state Exp;
branches;
next	1.1;

1.1
date	99.12.04.04.53.21;	author momjian;	state Exp;
branches;
next	;


desc
@@


1.29
log
@Change clusterdb and vacuumdb into C programs.
@
text
@#!/bin/sh
#-------------------------------------------------------------------------
#
# vacuumdb--
#    vacuum a postgres database
#
#    This script runs psql with the "-c" option to vacuum
#    the requested database.
#
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
#
# IDENTIFICATION
#    $Header: /cvsroot/pgsql-server/src/bin/scripts/vacuumdb,v 1.28 2003/06/11 05:13:12 momjian Exp $
#
#-------------------------------------------------------------------------

CMDNAME=`basename "$0"`
PATHNAME=`echo "$0" | sed "s,$CMDNAME\$,,"`

PSQLOPT=
full=
verbose=
analyze=
table=
dbname=
alldb=
quiet=0

while [ "$#" -gt 0 ]
do
    case "$1" in
	--help|-\?)
		usage=t
                break
		;;
# options passed on to psql
	--host|-h)
		PSQLOPT="$PSQLOPT -h $2"
		shift;;
        -h*)
                PSQLOPT="$PSQLOPT $1"
                ;;
        --host=*)
                PSQLOPT="$PSQLOPT -h `echo \"$1\" | sed 's/^--host=//'`"
                ;;
	--port|-p)
		PSQLOPT="$PSQLOPT -p $2"
		shift;;
        -p*)
                PSQLOPT="$PSQLOPT $1"
                ;;
        --port=*)
                PSQLOPT="$PSQLOPT -p `echo \"$1\" | sed 's/^--port=//'`"
                ;;
	--username|-U)
		PSQLOPT="$PSQLOPT -U $2"
		shift;;
        -U*)
                PSQLOPT="$PSQLOPT $1"
                ;;
        --username=*)
                PSQLOPT="$PSQLOPT -U `echo \"$1\" | sed 's/^--username=//'`"
                ;;
	--password|-W)
		PSQLOPT="$PSQLOPT -W"
		;;
	--echo|-e)
		ECHOOPT="-e"
		;;
	--quiet|-q)
		ECHOOPT="$ECHOOPT -o /dev/null"
                quiet=1
		;;
	--dbname|-d)
		dbname="$2"
		shift;;
        -d*)
                dbname=`echo $1 | sed 's/^-d//'`
                ;;
        --dbname=*)
                dbname=`echo $1 | sed 's/^--dbname=//'`
                ;;
# options converted into SQL command
	--analyze|-z)
		analyze="ANALYZE"
		;;
	--all|-a)
		alldb=Y
		;;
	--table|-t)
		table="$2"
		shift;;
        -t*)
                table=`echo $1 | sed 's/^-t//'`
                ;;
        --table=*)
                table=`echo $1 | sed 's/^--table=//'`
                ;;
	--full|-f)
		full="FULL"
		;;
	--verbose|-v)
		verbose="VERBOSE"
		;;

	-*)
		echo "$CMDNAME: invalid option: $1" 1>&2
                echo "Try '$CMDNAME --help' for more information." 1>&2
		exit 1
		;;
	*)
		dbname="$1"
		if [ "$#" -ne 1 ]; then
			echo "$CMDNAME: invalid option: $2" 1>&2
	                echo "Try '$CMDNAME --help' for more information." 1>&2
			exit 1
		fi
		;;
    esac
    shift
done

if [ "$usage" ]; then	
        echo "$CMDNAME cleans and analyzes a PostgreSQL database."
        echo
	echo "Usage:"
        echo "  $CMDNAME [OPTION]... [DBNAME]"
	echo
        echo "Options:"
	echo "  -a, --all                       vacuum all databases"
	echo "  -d, --dbname=DBNAME             database to vacuum"
	echo "  -t, --table='TABLE[(columns)]'  vacuum specific table only"
	echo "  -f, --full                      do full vacuuming"
	echo "  -z, --analyze                   update optimizer hints"
	echo "  -e, --echo                      show the command being sent to the backend"
        echo "  -q, --quiet                     don't write any output"
	echo "  -v, --verbose                   write a lot of output"
	echo " --help                           show this help, then exit"
	echo
	echo "Connection options:"
	echo "  -h, --host=HOSTNAME             database server host or socket directory"
	echo "  -p, --port=PORT                 database server port"
	echo "  -U, --username=USERNAME         user name to connect as"
	echo "  -W, --password                  prompt for password"
        echo
        echo "Read the description of the SQL command VACUUM for details."
        echo
	echo "Report bugs to <pgsql-bugs@@postgresql.org>."
	exit 0
fi

if [ "$alldb" ]; then
        if [ "$dbname" -o "$table" ]; then
                echo "$CMDNAME: cannot vacuum all databases and a specific one at the same time" 1>&2
                exit 1
        fi
	dbname=`${PATHNAME}psql $PSQLOPT -q -t -A -d template1 -c 'SELECT datname FROM pg_database WHERE datallowconn'`

elif [ -z "$dbname" ]; then
        if [ "$PGDATABASE" ]; then
                dbname="$PGDATABASE"
        elif [ "$PGUSER" ]; then
                dbname="$PGUSER"
        else
                dbname=`${PATHNAME}pg_id -u -n`
        fi
        [ "$?" -ne 0 ] && exit 1
fi

for db in $dbname
do
        [ "$alldb" -a "$quiet" -ne 1 ] && echo "Vacuuming $db"
	${PATHNAME}psql $PSQLOPT $ECHOOPT -c "VACUUM $full $verbose $analyze $table" -d $db
	if [ "$?" -ne 0 ]; then
	    echo "$CMDNAME: vacuum $table $db failed" 1>&2
	    exit 1
	fi
done

exit 0
@


1.28
log
@Document the -h client flag can use a socket directory as well as a host
name.
@
text
@d15 1
a15 1
#    $Header: /cvsroot/pgsql-server/src/bin/scripts/vacuumdb,v 1.27 2003/05/14 03:26:03 tgl Exp $
@


1.27
log
@Backend support for autocommit removed, per recent discussions.  The
only remnant of this failed experiment is that the server will take
SET AUTOCOMMIT TO ON.  Still TODO: provide some client-side autocommit
logic in libpq.
@
text
@d15 1
a15 1
#    $Header: /cvsroot/pgsql-server/src/bin/scripts/vacuumdb,v 1.26 2002/10/18 22:05:36 petere Exp $
d143 1
a143 1
	echo "  -h, --host=HOSTNAME             database server host"
@


1.26
log
@Improve formatting of --help output.
@
text
@d15 1
a15 1
#    $Header: /cvsroot/pgsql-server/src/bin/scripts/vacuumdb,v 1.25 2002/10/16 03:44:28 momjian Exp $
d175 1
a175 1
	${PATHNAME}psql $PSQLOPT $ECHOOPT -c "SET autocommit TO 'on';VACUUM $full $verbose $analyze $table" -d $db
@


1.25
log
@Improve appearance of SET command.
@
text
@d15 1
a15 1
#    $Header: /cvsroot/pgsql-server/src/bin/scripts/vacuumdb,v 1.24 2002/10/16 03:24:09 momjian Exp $
d129 1
a129 1
        echo "  $CMDNAME [options] [dbname]"
d132 15
a146 12
	echo "  -h, --host=HOSTNAME             Database server host"
	echo "  -p, --port=PORT                 Database server port"
	echo "  -U, --username=USERNAME         Username to connect as"
	echo "  -W, --password                  Prompt for password"
	echo "  -d, --dbname=DBNAME             Database to vacuum"
	echo "  -a, --all                       Vacuum all databases"
	echo "  -t, --table='TABLE[(columns)]'  Vacuum specific table only"
	echo "  -f, --full                      Do full vacuuming"
	echo "  -v, --verbose                   Write a lot of output"
	echo "  -z, --analyze                   Update optimizer hints"
	echo "  -e, --echo                      Show the command being sent to the backend"
        echo "  -q, --quiet                     Don't write any output"
@


1.24
log
@Fix script to handle autocommit = 'off' by prepending autocommit 'on' to
the start of the psql commandline.  This is better than adding BEGIN/END
because it handles multiple queries well, and allows the return code for
psql to return the proper value.
@
text
@d15 1
a15 1
#    $Header: /cvsroot/pgsql-server/src/bin/scripts/vacuumdb,v 1.23 2002/08/10 16:57:32 petere Exp $
d172 1
a172 1
	${PATHNAME}psql $PSQLOPT $ECHOOPT -c "SET autocommit = 'on';VACUUM $full $verbose $analyze $table" -d $db
@


1.23
log
@Make sure all clients have the same understanding of default user name
and database.  In particular, make script wrappers understand the
PGDATABASE environment variable.
@
text
@d15 1
a15 1
#    $Header: /cvsroot/pgsql-server/src/bin/scripts/vacuumdb,v 1.22 2002/06/20 20:29:42 momjian Exp $
d172 1
a172 1
	${PATHNAME}psql $PSQLOPT $ECHOOPT -c "VACUUM $full $verbose $analyze $table" -d $db
@


1.22
log
@Update copyright to 2002.
@
text
@d15 1
a15 1
#    $Header: /cvsroot/pgsql/src/bin/scripts/vacuumdb,v 1.21 2002/04/12 09:37:11 momjian Exp $
d159 3
a161 1
        if [ "$PGUSER" ]; then
@


1.21
log
@Allow dropdb and others to use identifiers with spaces;  IFS cleanup for
pg_dumpall.
@
text
@d10 1
a10 1
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
d15 1
a15 1
#    $Header: /cvsroot/pgsql/src/bin/scripts/vacuumdb,v 1.20 2002/02/18 05:48:45 momjian Exp $
@


1.20
log
@Fix param handling of create* admin scripts as described months ago.
Properly handles default values.
@
text
@d15 1
a15 1
#    $Header: /cvsroot/pgsql/src/bin/scripts/vacuumdb,v 1.19 2001/09/30 22:17:51 momjian Exp $
d20 1
a20 1
PATHNAME=`echo $0 | sed "s,$CMDNAME\$,,"`
d46 1
a46 1
                PSQLOPT="$PSQLOPT -h "`echo $1 | sed 's/^--host=//'`
d55 1
a55 1
                PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'`
d64 1
a64 1
                PSQLOPT="$PSQLOPT -U "`echo $1 | sed 's/^--username=//'`
@


1.19
log
@These are further fixes for double quotes missing in the various shell
scripts.

Justin Clift
@
text
@d15 1
a15 1
#    $Header: /cvsroot/pgsql/src/bin/scripts/vacuumdb,v 1.18 2001/09/22 04:28:12 momjian Exp $
d115 5
d159 6
a164 3
	echo "$CMDNAME: missing required argument: database name" 1>&2
        echo "Try '$CMDNAME -?' for help." 1>&2
	exit 1
@


1.18
log
@sbasename $0 is now basename "$0"
@
text
@d15 1
a15 1
#    $Header: /cvsroot/pgsql/src/bin/scripts/vacuumdb,v 1.17 2001/07/10 22:09:29 tgl Exp $
d31 1
a31 1
while [ $# -gt 0 ]
d163 1
a163 1
	if [ $? -ne 0 ]; then
@


1.17
log
@Changes from Vince Vielhaber to allow the optional clauses of CREATE
USER and ALTER USER to appear in any order, not only the fixed order
they used to be required to appear in.
Also, some changes from Tom Lane to create a FULL option for VACUUM;
it doesn't do anything yet, but I needed to change many of the same
files to make that happen, so now seemed like a good time.
@
text
@d15 1
a15 1
#    $Header: /home/projects/pgsql/cvsroot/pgsql/src/bin/scripts/vacuumdb,v 1.16 2001/02/18 18:34:02 momjian Exp $
d19 1
a19 1
CMDNAME=`basename $0`
@


1.16
log
@Add copyright mentions, per Tom Lane.
@
text
@d15 1
a15 1
#    $Header: /home/projects/pgsql/cvsroot/pgsql/src/bin/scripts/vacuumdb,v 1.15 2001/01/08 23:02:36 tgl Exp $
d23 1
d101 3
a132 1
	echo "  -z, --analyze                   Update optimizer hints"
d134 1
d136 1
d162 1
a162 1
	${PATHNAME}psql $PSQLOPT $ECHOOPT -c "VACUUM $verbose $analyze $table" -d $db
@


1.15
log
@Prevent vacuumdb from trying to vacuum template0.
@
text
@d10 2
a11 1
# Copyright (c) 1994, Regents of the University of California
d15 1
a15 1
#    $Header: /home/projects/pgsql/cvsroot/pgsql/src/bin/scripts/vacuumdb,v 1.14 2001/01/08 20:32:27 tgl Exp $
@


1.14
log
@check for failure after vacuuming each DB, not only the last one.
@
text
@d14 1
a14 1
#    $Header: /home/projects/pgsql/cvsroot/pgsql/src/bin/scripts/vacuumdb,v 1.13 2000/11/25 19:05:44 petere Exp $
d145 1
a145 1
	dbname=`${PATHNAME}psql $PSQLOPT -q -t -A -d template1 -c 'SELECT datname FROM pg_database'`
@


1.13
log
@Advertise --help (rather than '-?') as help option (problems with csh).
Accept --help even if no general long options support exists.
@
text
@d14 1
a14 1
#    $Header: /home/projects/pgsql/cvsroot/pgsql/src/bin/scripts/vacuumdb,v 1.12 2000/11/13 23:37:53 momjian Exp $
d148 1
a148 1
	echo "$CMDNAME: missing required argument database name" 1>&2
d157 4
a161 5

if [ $? -ne 0 ]; then
	echo "$CMDNAME: vacuum failed" 1>&2
	exit 1
fi
@


1.12
log
@Remove -k unix socketpath option from client side, allow hostname with
leading slash to behave as a unix socket path.
@
text
@d14 1
a14 1
#    $Header: /home/projects/pgsql/cvsroot/pgsql/src/bin/scripts/vacuumdb,v 1.11 2000/11/13 15:18:14 momjian Exp $
d105 1
a105 1
                echo "Try '$CMDNAME -?' for help." 1>&2
@


1.11
log
@UUNET is looking into offering PostgreSQL as a part of a managed web
hosting product, on both shared and dedicated machines.  We currently
offer Oracle and MySQL, and it would be a nice middle-ground.
However, as shipped, PostgreSQL lacks the following features we need
that MySQL has:

1. The ability to listen only on a particular IP address.  Each
   hosting customer has their own IP address, on which all of their
   servers (http, ftp, real media, etc.) run.
2. The ability to place the Unix-domain socket in a mode 700 directory.
   This allows us to automatically create an empty database, with an
   empty DBA password, for new or upgrading customers without having
   to interactively set a DBA password and communicate it to (or from)
   the customer.  This in turn cuts down our install and upgrade times.
3. The ability to connect to the Unix-domain socket from within a
   change-rooted environment.  We run CGI programs chrooted to the
   user's home directory, which is another reason why we need to be
   able to specify where the Unix-domain socket is, instead of /tmp.
4. The ability to, if run as root, open a pid file in /var/run as
   root, and then setuid to the desired user.  (mysqld -u can almost
   do this; I had to patch it, too).

The patch below fixes problem 1-3.  I plan to address #4, also, but
haven't done so yet.  These diffs are big enough that they should give
the PG development team something to think about in the meantime :-)
Also, I'm about to leave for 2 weeks' vacation, so I thought I'd get
out what I have, which works (for the problems it tackles), now.

With these changes, we can set up and run PostgreSQL with scripts the
same way we can with apache or proftpd or mysql.

In summary, this patch makes the following enhancements:

1. Adds an environment variable PGUNIXSOCKET, analogous to MYSQL_UNIX_PORT,
   and command line options -k --unix-socket to the relevant programs.
2. Adds a -h option to postmaster to set the hostname or IP address to
   listen on instead of the default INADDR_ANY.
3. Extends some library interfaces to support the above.
4. Fixes a few memory leaks in PQconnectdb().

The default behavior is unchanged from stock 7.0.2; if you don't use
any of these new features, they don't change the operation.

David J. MacKenzie
@
text
@d14 1
a14 1
#    $Header: /home/projects/pgsql/cvsroot/pgsql/src/bin/scripts/vacuumdb,v 1.10 2000/11/11 22:59:48 petere Exp $
a54 9
	--unixsocket|-k)
		PSQLOPT="$PSQLOPT -k $2"
		shift;;
        -k*)
                PSQLOPT="$PSQLOPT $1"
                ;;
        --unixsocket=*)
                PSQLOPT="$PSQLOPT -k "`echo $1 | sed 's/^--unixsocket=//'`
                ;;
a123 1
	echo "  -k, --unixsocket=PATH           Database server Unix-domain socket name"
@


1.10
log
@Make sure shell scripts send error messages to stderr.
Improve help output.
Teach droplang to remove 'pltclu'.
@
text
@d14 1
a14 1
#    $Header: /home/projects/pgsql/cvsroot/pgsql/src/bin/scripts/vacuumdb,v 1.9 2000/01/19 20:08:36 petere Exp $
d55 9
d133 1
@


1.9
log
@another round of user interface cleanups
removed pg_id
fixed a few bugs in the scripts
@
text
@d14 1
a14 1
#    $Header: /usr/local/cvsroot/pgsql/src/bin/scripts/vacuumdb,v 1.8 2000/01/12 19:36:36 petere Exp $
d104 2
a105 2
		echo "$CMDNAME: invalid option: $1"
                echo "Try -? for help."
d134 2
d142 1
a142 1
                echo "$CMDNAME: cannot vacuum all databases and a specific one at the same time"
d148 2
a149 2
	echo "$CMDNAME: missing required argument database name"
        echo "Try -? for help."
d160 1
a160 1
	echo "$CMDNAME: vacuum failed"
@


1.8
log
@Fixed a few "fixes" and bugs. Adjusted messages and options to GNU suggestions.
@
text
@d14 1
a14 1
#    $Header: /usr/local/cvsroot/pgsql/src/bin/scripts/vacuumdb,v 1.7 1999/12/18 08:46:44 momjian Exp $
d19 1
d27 1
d55 2
a56 2
	--user|--username|-U)
		PSQLOPT="$PSQLOPT -U '$2'"
a60 3
        --user=*)
                PSQLOPT="$PSQLOPT -U "`echo $1 | sed 's/^--user=//'`
                ;;
d68 1
a68 1
		PSQLOPT="$PSQLOPT -e"
d71 2
a72 1
		PSQLOPT="$PSQLOPT -o /dev/null"
d74 1
a74 1
	--dbname|--database|-d)
a82 3
        --database=*)
                dbname=`echo $1 | sed 's/^--database=//'`
                ;;
d85 1
a85 1
		analyze="ANALYZE "
d100 1
a100 1
		verbose="VERBOSE "
d104 1
a104 1
		echo "$CMDNAME: unrecognized option: $1"
d116 6
a121 2
	echo "Usage: $CMDNAME [options] [dbname]"
	echo ""
d131 1
a131 1
#???	echo "  -e, --echo                      "
d133 2
d143 1
a143 2
	dbname="`psql $PSQLOPT -q -t -A -d template1 -c 'SELECT datname FROM pg_database'`"
fi
d145 1
a145 1
if [ -z "$dbname" ]; then
d153 2
a154 1
	psql $PSQLOPT -c "vacuum $verbose $analyze $table" -d $dbname
@


1.7
log
@Cleanup --alldb option handling.
@
text
@d14 1
a14 1
#    $Header: /usr/local/cvsroot/pgsql/src/bin/scripts/vacuumdb,v 1.6 1999/12/18 08:39:12 momjian Exp $
d32 1
d90 1
a90 1
	--alldb|-a)
d107 2
a108 1
		echo "$CMDNAME: Unrecognized option: $1. Try -? for help."
a118 1
	echo ""
d121 12
a132 14
	echo "    -h HOSTNAME,         --host=HOSTNAME     "
	echo "    -p PORT,             --port=PORT         "
	echo "    -u USERNAME,         --username=USERNAME "
	echo "    -W,                  --password          "
	echo "    -d DBNAME,           --database=DBNAME   "
	echo "    -z,                  --analyze           "
	echo "    -a,                  --alldb             "
	echo "    -t TABLE[(columns)], --table=TABLE[(columns)]"
	echo "    -v,                  --verbose           "
	echo "    -e,                  --echo              "
        echo "    -q,                  --quiet             "   
	echo "    -?,                  --help              "
	echo ""
	exit 1
d135 6
a140 2
if [ ! -z "$alldb" ]; then
	dbname="`psql $PASSWDOPT $AUTHOPT $PGHOSTOPT $PGPORTOPT -q -t -A -d template1 -c 'SELECT datname FROM pg_database'`"
d144 2
a145 1
	echo "$CMDNAME: Missing required argument database name. Try -? for help."
d151 1
a151 1
	psql $PASSWDOPT -tq $AUTHOPT $PGHOSTOPT $PGPORTOPT -c "vacuum $verbose $analyze $table" $db
d154 2
a155 3
if [ $? -ne 0 ]
then
	echo "$CMDNAME: Vacuum failed."
@


1.6
log
@Cleanup vacuumdb
@
text
@d14 1
a14 1
#    $Header: /usr/local/cvsroot/pgsql/src/bin/scripts/vacuumdb,v 1.5 1999/12/18 08:34:50 momjian Exp $
d25 1
d90 1
a90 1
		dbname="`psql $PASSWDOPT $AUTHOPT $PGHOSTOPT $PGPORTOPT -q -t -A -d template1 -c 'SELECT datname FROM pg_database'`"
d134 4
@


1.5
log
@
> > It would be nice for new users; I think it would make it easier
> > for them to actually set out and do it.  Many new users are
> > of the not-so-knowledgable variety, and shell scripting isn't
> > something they want to undertake.
>
> Can someone modify the vacuumdb shell script to do that?
i tried it... it seems to work

neko@@kredit.sth.sz
@
text
@d14 1
a14 1
#    $Header: /usr/local/cvsroot/pgsql/src/bin/scripts/vacuumdb,v 1.4 1999/12/16 20:10:02 momjian Exp $
a41 2
	--alldb|-a) 
		dbname="`psql $PASSWDOPT $AUTHOPT $PGHOSTOPT $PGPORTOPT -q -t -A -d template1 -c 'SELECT datname FROM pg_database'`";;
d87 3
@


1.4
log
@Hi,

I sending promised patch with:

        * getopt_long() - for pg_dump (portable)

        * and "Usage: " changes in scripts in src/bin/
          - this changes are cosmetic only, not change any
          feature ...etc.

 All PostgreSQL routines (scripts) support now long options and
help's output is alike for all scripts and all support -? or --help.

                                                Karel

Karel Zak <zakkr@@zf.jcu.cz>              http://home.zf.jcu.cz/~zakkr/
@
text
@d14 1
a14 1
#    $Header: /usr/local/cvsroot/pgsql/src/bin/scripts/vacuumdb,v 1.3 1999/12/07 22:41:44 momjian Exp $
d42 2
d124 1
d139 4
a142 1
psql $PSQLOPT -d "$dbname" -c "VACUUM $verbose$analyze$table"
d144 2
a145 1
if [ $? -ne 0 ]; then
@


1.3
log
@Okay, that should put us back in sync. These two patches (src & doc) are
against the sources from one hour ago and contain all the portable and
up
to date stuff.

A few other CVS "householding" things you might want to take care of:

* Remove the src/bin/cleardbdir directory

* Remove the file src/bin/psql/sql_help.h from the repository, as it is
a derived file and is build by the release_prep.

Peter Eisentraut
@
text
@d14 1
a14 1
#    $Header: /usr/local/cvsroot/pgsql/src/bin/vacuumdb/vacuumdb,v 1.1 1998/11/14 01:58:15 thomas Exp $
a30 1
		break
d112 17
a128 5

if [ "$usage" ]; then
	echo "Usage: $CMDNAME [-h server] [-p port] [-U username] [-d dbname] \\"
	echo "       [-z|--analyze] [-v|--verbose] [-t|--table 'table[(columns)]'] [dbname]"
	exit 0
@


1.2
log
@I cleaned those out as well (the echo -n "bug" was in there ;) and moved
them into the scripts dir. I also added a --list option to show already
installed languages.

This whole moving and renaming totally confused CVS and my checked out
copy got completely fried last night. When you apply the source patch,
please make sure that all the directories src/bin/{create|destroy}* as
well as vacuumdb, cleardbdir are gone and that all the scripts (7) are
in
scripts/.

Meanwhile I am still puzzled about what happened with the docs patch.
Because I don't know what you got now, the second attachment contains
the
files

ref/allfiles.sgml
ref/commands.sgml
ref/createlang.sgml
ref/droplang.sgml
doc/src/sgml/Makefile

Peter Eisentraut                  Sernanders vg 10:115
@
text
@d14 1
a14 1
#    $Header: /usr/local/cvsroot/pgsql/src/bin/scripts/vacuumdb,v 1.1 1999/12/04 04:53:21 momjian Exp $
d24 1
d37 6
d46 6
d53 1
a53 1
		PSQLOPT="$PSQLOPT -U $2"
d55 9
d73 3
d87 1
a87 1
		analyze="analyze"
d90 1
a90 1
		table=$2
d92 6
d99 1
a99 1
		verbose="verbose"
d106 1
a106 2

	 *)
d115 1
a115 1
	echo "Usage: $CMDNAME [-h <server>] [-p <port>] [-U <username>] [-W] [-d <dbname>] \\"
d125 1
a125 1
psql $PSQLOPT -d "$dbname" -c "VACUUM $verbose $analyze $table"
d128 1
a128 1
	echo "$CMDNAME: Database vacuum failed."
@


1.1
log
@New scripts for create/drop user/db from Peter Eisentraut
@
text
@d14 1
a14 1
#    $Header: /usr/local/cvsroot/pgsql/src/bin/vacuumdb/vacuumdb,v 1.1 1998/11/14 01:58:15 thomas Exp $
d51 9
a59 3
	--dbname|--database|-d)
		dbname="$2"
		shift;;
@
