<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/ref/createlang.sgml,v 1.3 1999/12/05 20:02:42 momjian Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/createlang.sgml,v 1.4 2000/01/19 20:08:22 petere Exp $
Postgres documentation
-->
</listitem>
</varlistentry>
- <varlistentry>
- <term>-e, --echo</term>
- <listitem>
- <para>
- Echo the commands that <application>createlang</application> generates
- and sends to the backend.
- </para>
- </listitem>
- </varlistentry>
-
</variablelist>
</para>
</refsect2>
for details. Check also under <xref linkend="APP-PSQL" endterm="APP-PSQL-title">
for more possibilities.
</para>
- <para>
- No output is generated if <application>createlang</application> succeeds.
- </para>
</refsect2>
</refsynopsisdiv>
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/ref/droplang.sgml,v 1.1 1999/12/05 20:04:39 momjian Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/droplang.sgml,v 1.2 2000/01/19 20:08:22 petere Exp $
Postgres documentation
-->
</listitem>
</varlistentry>
- <varlistentry>
- <term>-e, --echo</term>
- <listitem>
- <para>
- Echo the commands that <application>droplang</application> generates
- and sends to the backend.
- </para>
- </listitem>
- </varlistentry>
-
</variablelist>
</para>
</refsect2>
for details. Check also under <xref linkend="APP-PSQL" endterm="APP-PSQL-title">
for more possibilities.
</para>
- <para>
- No output is generated if <application>droplang</application> succeeds.
- </para>
</refsect2>
</refsynopsisdiv>
#-------------------------------------------------------------------------
#
# Makefile
-# Makefile for src/bin (utility programs)
+# Makefile for src/bin (client programs)
#
# Copyright (c) 1994, Regents of the University of California
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/Makefile,v 1.23 2000/01/19 02:58:59 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/Makefile,v 1.24 2000/01/19 20:08:23 petere Exp $
#
#-------------------------------------------------------------------------
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.80 2000/01/18 00:03:35 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.81 2000/01/19 20:08:24 petere Exp $
#
#-------------------------------------------------------------------------
echo " -d, --debug Generate lots of debugging output"
echo " -n, --noclean Do not clean up after errors"
echo
- echo "Report bugs to <bugs@postgresql.org>."
+ echo "Report bugs to <pgsql-bugs@postgresql.org>."
exit 0
fi
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/initlocation/Attic/initlocation.sh,v 1.4 2000/01/18 00:03:36 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/initlocation/Attic/initlocation.sh,v 1.5 2000/01/19 20:08:25 petere Exp $
#
#-------------------------------------------------------------------------
echo "Usage:"
echo " $CMDNAME <location>"
echo ""
- echo "Report bugs to <bugs@postgresql.org>."
+ echo "Report bugs to <pgsql-bugs@postgresql.org>."
exit 0
fi
#!/bin/sh
#
-# $Header: /cvsroot/pgsql/src/bin/ipcclean/Attic/ipcclean.sh,v 1.3 2000/01/18 00:03:36 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/ipcclean/Attic/ipcclean.sh,v 1.4 2000/01/19 20:08:27 petere Exp $
#
CMDNAME=`basename $0`
echo
echo "Note: Since the utilities underlying this script are very different"
echo "from platform to platform, chances are that it might not work on"
- echo "yours. If that is the case, please write to <bugs@postgresql.org>"
+ echo "yours. If that is the case, please write to <pgsql-bugs@postgresql.org>"
echo "so that your platform can be supported in the future."
exit 0
fi
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.136 2000/01/19 02:58:59 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.137 2000/01/19 20:08:30 petere Exp $
*
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
*
);
#endif
puts("If no database name is not supplied, then the PGDATABASE environment\nvariable value is used.\n");
- puts("Report bugs to <bugs@postgresql.org>.");
+ puts("Report bugs to <pgsql-bugs@postgresql.org>.");
}
+++ /dev/null
-#-------------------------------------------------------------------------
-#
-# Makefile.inc--
-# Makefile for bin/pg_id
-#
-# Copyright (c) 1994, Regents of the University of California
-#
-#
-# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/Makefile,v 1.12 1999/01/17 06:19:10 momjian Exp $
-#
-#-------------------------------------------------------------------------
-
-SRCDIR= ../..
-include ../../Makefile.global
-
-OBJS= pg_id.o
-
-#
-# And where libpq goes, so goes the authentication stuff...
-#
-ifdef KRBVERS
-LDFLAGS+= $(KRBLIBS)
-CFLAGS+= $(KRBFLAGS)
-endif
-
-all: pg_id
-
-pg_id: $(OBJS) $(LIBPQDIR)/libpq.a
- $(CC) -o pg_id -L$(LIBPQDIR) $(OBJS) -lpq $(LDFLAGS)
-
-$(LIBPQDIR)/libpq.a:
- $(MAKE) -C $(LIBPQDIR) libpq.a
-
-install: pg_id
- $(INSTALL) $(INSTL_EXE_OPTS) pg_id$(X) $(BINDIR)/pg_id$(X)
-
-depend dep:
- $(CC) -MM $(CFLAGS) *.c >depend
-
-clean:
- rm -f pg_id$(X) $(OBJS)
-
-ifeq (depend,$(wildcard depend))
-include depend
-endif
+++ /dev/null
-/*-------------------------------------------------------------------------
- *
- * pg_id.c
- * Print the user ID for the login name passed as argument,
- * or the real user ID of the caller if no argument. If the
- * login name doesn't exist, print "NOUSER" and exit 1.
- *
- * Copyright (c) 1994, Regents of the University of California
- *
- *
- * IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.9 1999/07/19 02:27:09 momjian Exp $
- *
- *-------------------------------------------------------------------------
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <pwd.h>
-
-#include "postgres.h"
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#endif
-
-int
-main(int argc, char **argv)
-{
- struct passwd *pw;
- int ch;
- extern int optind;
-
- while ((ch = getopt(argc, argv, "")) != EOF)
- switch (ch)
- {
- case '?':
- default:
- fprintf(stderr, "usage: pg_id [login]\n");
- exit(1);
- }
- argc -= optind;
- argv += optind;
-
- if (argc > 0)
- {
- if (argc > 1)
- {
- fprintf(stderr, "usage: pg_id [login]\n");
- exit(1);
- }
- if ((pw = getpwnam(argv[0])) == NULL)
- {
- printf("NOUSER\n");
- exit(1);
- }
- printf("%ld\n", (long) pw->pw_uid);
- }
- else
- printf("%ld\n", (long) getuid());
-
- exit(0);
-}
*
* Copyright 2000 by PostgreSQL Global Development Team
*
- * $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.9 2000/01/18 23:30:23 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.10 2000/01/19 20:08:33 petere Exp $
*/
#include <c.h>
#include "common.h"
fflush(pset.queryFout);
if (pset.inputfile)
- fprintf(stderr, "%s:%u: ", pset.inputfile ? pset.inputfile : pset.progname, pset.lineno);
+ fprintf(stderr, "%s:%s:%u: ", pset.progname, pset.inputfile, pset.lineno);
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
*
* Copyright 2000 by PostgreSQL Global Development Team
*
- * $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.11 2000/01/18 23:30:23 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.12 2000/01/19 20:08:34 petere Exp $
*/
#include <c.h>
#include "help.h"
puts( "(for SQL commands) from within psql, or consult the psql section in");
puts( "the PostgreSQL manual, which accompanies the distribution and is also");
puts( "available at <http://www.postgresql.org>.");
- puts( "Report bugs to <bugs@postgresql.org>.");
+ puts( "Report bugs to <pgsql-bugs@postgresql.org>.");
#ifndef WIN32
if (pw)
*
* Copyright 2000 by PostgreSQL Global Development Team
*
- * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.16 2000/01/18 23:30:24 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.17 2000/01/19 20:08:34 petere Exp $
*/
#include <c.h>
successResult = process_file(options.action_string) ? 0 : 1;
/* process slash command if one was given to -c */
else if (options.action == ACT_SINGLE_SLASH)
+ {
+ if (GetVariable(pset.vars, "ECHO") && strcmp(GetVariable(pset.vars, "ECHO"), "full")==0)
+ puts(options.action_string);
successResult = HandleSlashCmds(options.action_string, NULL, NULL) != CMD_ERROR ? 0 : 1;
+ }
/* If the query given to -c was a normal one, send it */
else if (options.action == ACT_SINGLE_QUERY)
+ {
+ if (GetVariable(pset.vars, "ECHO") && strcmp(GetVariable(pset.vars, "ECHO"), "full")==0)
+ puts(options.action_string);
successResult = SendQuery( options.action_string) ? 0 : 1;
+ }
/* or otherwise enter interactive main loop */
else
{
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createdb,v 1.6 2000/01/12 19:36:36 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createdb,v 1.7 2000/01/19 20:08:35 petere Exp $
#
#-------------------------------------------------------------------------
CMDNAME=`basename $0`
+PATHNAME=`echo $0 | sed "s,$CMDNAME\$,,"`
MB=
PSQLOPT=
--port=*)
PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'`
;;
- --user|--username|-U)
- PSQLOPT="$PSQLOPT -U '$2'"
+ --username|-U)
+ PSQLOPT="$PSQLOPT -U $2"
shift;;
-U*)
PSQLOPT="$PSQLOPT $1"
;;
- --user=*)
- PSQLOPT="$PSQLOPT -U "`echo $1 | sed 's/^--user=//'`
- ;;
--username=*)
PSQLOPT="$PSQLOPT -U "`echo $1 | sed 's/^--username=//'`
;;
MB=`echo $1 | sed 's/^--encoding=//'`
;;
-*)
- echo "$CMDNAME: unrecognized option: $1"
+ echo "$CMDNAME: invalid option: $1"
echo "Try -? for help."
exit 1
;;
done
if [ "$usage" ]; then
- echo "Usage: $CMDNAME [options] dbname [description]"
- echo ""
+ echo "$CMDNAME creates a PostgreSQL database."
+ echo
+ echo "Usage:"
+ echo " $CMDNAME [options] dbname [description]"
+ echo
+ echo "Options:"
echo " -D, --location=PATH Alternative place to store the database"
echo " -E, --encoding=ENCODING Multibyte encoding for the database"
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 " -e, --echo "
- echo " -q, --quiet Don't write any messages"
+ echo " -e, --echo Show the query being sent to the backend"
+ echo " -q, --quiet Don't write any messages"
+ echo
+ echo "Report bugs to <pgsql-bugs@postgresql.org>."
exit 0
fi
[ "$MB" ] && withstring="$withstring ENCODING = '$MB'"
[ "$withstring" ] && withstring=" WITH$withstring"
-psql $PSQLOPT -d template1 -c "CREATE DATABASE \"$dbname\"$withstring"
+${PATHNAME}psql $PSQLOPT -d template1 -c "CREATE DATABASE \"$dbname\"$withstring"
if [ $? -ne 0 ]; then
echo "$CMDNAME: database creation failed"
exit 1
dbcomment=`echo $dbcomment | sed "s/'/\\\\\'/g"`
-psql $PSQLOPT -d template1 -c "COMMENT ON DATABASE \"$dbname\" IS '$dbcomment'"
+${PATHNAME}psql $PSQLOPT -d template1 -c "COMMENT ON DATABASE \"$dbname\" IS '$dbcomment'"
if [ $? -ne 0 ]; then
echo "$CMDNAME: comment creation failed (database was created)"
exit 1
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.5 2000/01/12 19:36:36 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.6 2000/01/19 20:08:35 petere Exp $
#
#-------------------------------------------------------------------------
CMDNAME=`basename $0`
+PATHNAME=`echo $0 | sed "s,$CMDNAME\$,,"`
PSQLOPT=
dbname=
langname=
-echo=
list=
# Check for echo -n vs echo \c
--port=*)
PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'`
;;
- --user|--username|-U)
- PSQLOPT="$PSQLOPT -U '$2'"
+ --username|-U)
+ PSQLOPT="$PSQLOPT -U $2"
shift;;
-U*)
PSQLOPT="$PSQLOPT $1"
;;
- --user=*)
- PSQLOPT="$PSQLOPT -U "`echo $1 | sed 's/^--user=//'`
- ;;
--username=*)
PSQLOPT="$PSQLOPT -U "`echo $1 | sed 's/^--username=//'`
;;
--password|-W)
PSQLOPT="$PSQLOPT -W"
;;
- --echo|-e)
- echo=t
- ;;
- --dbname|--database|-d)
+ --dbname|-d)
dbname="$2"
shift;;
-d*)
--dbname=*)
dbname=`echo $1 | sed 's/^--dbname=//'`
;;
- --database=*)
- dbname=`echo $1 | sed 's/^--database=//'`
- ;;
# misc options
--pglib|-L)
PGLIB="$2"
;;
-*)
- echo "$CMDNAME: unrecognized option: $1"
+ echo "$CMDNAME: invalid option: $1"
echo "Try -? for help."
exit 1
;;
done
if [ "$usage" ]; then
- echo ""
- echo "Usage: $CMDNAME [options] [langname [dbname]]"
- echo ""
+ echo "$CMDNAME installs a procedural language into a PostgreSQL database."
+ echo
+ echo "Usage:"
+ echo " $CMDNAME [options] [langname [dbname]]"
+ echo
+ echo "Options:"
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 install language in"
- echo " -e, --echo Create some output about what is happening"
echo " -L, --pglib=PGLIB Find language interpreter in directory PGLIB"
echo " -l, --list Show a list of currently installed languages"
+ echo
+ echo "Report bugs to <pgsql-bugs@postgresql.org>."
exit 0
fi
-if [ "$list" ]; then
- psql $PSQLOPT -d "$dbname" -c "SELECT lanname, lanpltrusted, lancompiler FROM pg_language WHERE lanispl = 't'"
- exit $?
-fi
-
# ----------
# Check that we have a database
fi
+# ----------
+# List option
+# ----------
+if [ "$list" ]; then
+ ${PATHNAME}psql $PSQLOPT -d "$dbname" -P 'title=Procedural languages' -c "SELECT lanname as \"Name\", lanpltrusted as \"Trusted?\", lancompiler as \"Compiler\" FROM pg_language WHERE lanispl = 't'"
+ exit $?
+fi
+
+
# ----------
# Check that we have PGLIB
# ----------
fi
-if [ "$echo" ]; then
- PSQLOPT="$PSQLOPT -e"
-else
- PSQLOPT="$PSQLOPT -q"
-fi
-
-PSQL="psql -A -t $PSQLOPT -d $dbname -c"
+PSQL="${PATHNAME}psql -A -t -q $PSQLOPT -d $dbname -c"
# ----------
# Make sure the language isn't already installed
exit 1
fi
+echo "Ok"
exit 0
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createuser,v 1.7 2000/01/19 02:59:01 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createuser,v 1.8 2000/01/19 20:08:36 petere Exp $
#
# Note - this should NOT be setuid.
#
#-------------------------------------------------------------------------
CMDNAME=`basename $0`
+PATHNAME=`echo $0 | sed "s,$CMDNAME\$,,"`
NewUser=
SysID=
;;
# Note: These two specify the user to connect as (like in psql),
# not the user you're creating.
- --user|--username|-U)
- PSQLOPT="$PSQLOPT -U '$2'"
+ --username|-U)
+ PSQLOPT="$PSQLOPT -U $2"
shift;;
-U*)
PSQLOPT="$PSQLOPT $1"
;;
- --user=*)
- PSQLOPT="$PSQLOPT -U "`echo $1 | sed 's/^--user=//'`
- ;;
--username=*)
PSQLOPT="$PSQLOPT -U "`echo $1 | sed 's/^--username=//'`
;;
PwPrompt=t
;;
-*)
- echo "$CMDNAME: unrecognized option: $1"
+ echo "$CMDNAME: invalid option: $1"
echo "Try -? for help."
exit 1
;;
done
if [ "$usage" ]; then
- echo "Usage: $CMDNAME [options] [username]"
- echo ""
+ echo "$CMDNAME creates a new PostgreSQL user."
+ echo
+ echo "Usage:"
+ echo " $CMDNAME [options] [username]"
+ echo
+ echo "Options:"
echo " -d, --createdb User can create new databases"
echo " -D, --no-createdb User cannot create databases"
echo " -a, --adduser User can add new users"
echo " -p, --port=PORT Database server port"
echo " -U, --username=USERNAME Username to connect as (not the one to create)"
echo " -W, --password Prompt for password to connect"
-#??? echo " -e, --echo "
- echo " -q, --quiet Don't write any messages"
+ echo " -e, --echo Show the query being sent to the backend"
+ echo " -q, --quiet Don't write any messages"
+ echo
+ echo "Report bugs to <pgsql-bugs@postgresql.org>."
exit 0
fi
[ "$CanAddUser" = t ] && QUERY="$QUERY CREATEUSER"
[ "$CanAddUser" = f ] && QUERY="$QUERY NOCREATEUSER"
-psql $PSQLOPT -d template1 -c "$QUERY"
+${PATHNAME}psql -c "$QUERY" -d template1 $PSQLOPT
if [ $? -ne 0 ]; then
echo "$CMDNAME: creation of user \"$NewUser\" failed"
exit 1
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropdb,v 1.5 2000/01/12 19:36:36 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropdb,v 1.6 2000/01/19 20:08:36 petere Exp $
#
#-------------------------------------------------------------------------
CMDNAME=`basename $0`
+PATHNAME=`echo $0 | sed "s,$CMDNAME\$,,"`
PSQLOPT=
dbname=
--port=*)
PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'`
;;
- --user|--username|-U)
- PSQLOPT="$PSQLOPT -U '$2'"
+ --username|-U)
+ PSQLOPT="$PSQLOPT -U $2"
shift;;
-U*)
PSQLOPT="$PSQLOPT $1"
;;
- --user=*)
- PSQLOPT="$PSQLOPT -U "`echo $1 | sed 's/^--user=//'`
- ;;
--username=*)
PSQLOPT="$PSQLOPT -U "`echo $1 | sed 's/^--username=//'`
;;
forcedel=f
;;
-*)
- echo "$CMDNAME: Unrecognized option: $1. Try -? for help."
+ echo "$CMDNAME: invalid option: $1"
+ echo "Try -? for help."
exit 1
;;
*)
if [ "$usage" ]; then
- echo "Usage: $CMDNAME [options] dbname"
- echo ""
+ echo "$CMDNAME removes a PostgreSQL database."
+ echo
+ echo "Usage:"
+ echo " $CMDNAME [options] dbname"
+ echo
+ echo "Options:"
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 " -i, --interactive Prompt before deleting anything"
-#??? echo " -e, --echo "
- echo " -q, --quiet Don't write any messages"
+ echo " -e, --echo Show the query being sent to the backend"
+ echo " -q, --quiet Don't write any messages"
+ echo
+ echo "Report bugs to <pgsql-bugs@postgresql.org>."
exit 0
fi
dbname=`echo $dbname | sed 's/\"/\\\"/g'`
-psql $PSQLOPT -d template1 -c "DROP DATABASE \"$dbname\""
+${PATHNAME}psql $PSQLOPT -d template1 -c "DROP DATABASE \"$dbname\""
if [ $? -ne 0 ]; then
echo "$CMDNAME: database removal failed"
exit 1
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/droplang,v 1.5 2000/01/12 19:36:36 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/droplang,v 1.6 2000/01/19 20:08:36 petere Exp $
#
#-------------------------------------------------------------------------
CMDNAME=`basename $0`
+PATHNAME=`echo $0 | sed "s,$CMDNAME\$,,"`
PSQLOPT=
dbname=
--port=*)
PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'`
;;
- --user|--username|-U)
- PSQLOPT="$PSQLOPT -U '$2'"
+ --username|-U)
+ PSQLOPT="$PSQLOPT -U $2"
shift;;
-U*)
PSQLOPT="$PSQLOPT $1"
;;
- --user=*)
- PSQLOPT="$PSQLOPT -U "`echo $1 | sed 's/^--user=//'`
- ;;
--username=*)
PSQLOPT="$PSQLOPT -U "`echo $1 | sed 's/^--username=//'`
;;
--password|-W)
PSQLOPT="$PSQLOPT -W"
;;
- --echo|-e)
- echo=t
- ;;
- --dbname|--database|-d)
+ --dbname|-d)
dbname="$2"
shift;;
-d*)
--dbname=*)
dbname=`echo $1 | sed 's/^--dbname=//'`
;;
- --database=*)
- dbname=`echo $1 | sed 's/^--database=//'`
- ;;
-*)
- echo "$CMDNAME: unrecognized option: $1"
+ echo "$CMDNAME: invalid option: $1"
echo "Try -? for help."
exit 1
;;
if [ "$usage" ]; then
- echo ""
- echo "Usage: $CMDNAME [options] [langname [dbname]]"
- echo ""
+ echo "$CMDNAME removes a procedural language from a database."
+ echo
+ echo "Usage:"
+ echo " $CMDNAME [options] [langname [dbname]]"
+ echo
+ echo "Options:"
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 remove language from"
- echo " -e, --echo Create some output about what is happening"
echo " -l, --list Show a list of currently installed languages"
+ echo
+ echo "Report bugs to <pgsql-bugs@postgresql.org>."
exit 0
fi
if [ "$list" ]; then
- psql $PSQLOPT -d "$dbname" -c "SELECT lanname, lanpltrusted, lancompiler FROM pg_language WHERE lanispl = 't'"
+ ${PATHNAME}psql $PSQLOPT -d "$dbname" -P 'title=Procedural languages' -c "SELECT lanname as \"Name\", lanpltrusted as \"Trusted?\", lancompiler as \"Compiler\" FROM pg_language WHERE lanispl = 't'"
exit $?
fi
esac
-if [ "$echo" ]; then
- PSQLOPT="$PSQLOPT -e"
-else
- PSQLOPT="$PSQLOPT -q"
-fi
-
-PSQL="psql -A -t $PSQLOPT -d $dbname -c"
+PSQL="${PATHNAME}psql -A -t -q $PSQLOPT -d $dbname -c"
# ----------
exit 1
fi
+echo "Ok"
exit 0
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropuser,v 1.5 2000/01/12 19:36:36 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropuser,v 1.6 2000/01/19 20:08:36 petere Exp $
#
# Note - this should NOT be setuid.
#
#-------------------------------------------------------------------------
CMDNAME=`basename $0`
+PATHNAME=`echo $0 | sed "s,$CMDNAME\$,,"`
+
PSQLOPT=
forcedel=t
DelUser=
;;
# Note: These two specify the user to connect as (like in psql),
# not the user you're dropping.
- --user|--username|-U)
- PSQLOPT="$PSQLOPT -U '$2'"
+ --username|-U)
+ PSQLOPT="$PSQLOPT -U $2"
shift;;
-U*)
PSQLOPT="$PSQLOPT $1"
;;
- --user=*)
- PSQLOPT="$PSQLOPT -U "`echo $1 | sed 's/^--user=//'`
- ;;
--username=*)
PSQLOPT="$PSQLOPT -U "`echo $1 | sed 's/^--username=//'`
;;
forcedel=f
;;
-*)
- echo "$CMDNAME: Unrecognized option: $1. Try -? for help."
+ echo "$CMDNAME: invalid option: $1"
+ echo "Try -? for help."
exit 1
;;
*)
if [ "$usage" ]; then
- echo ""
- echo "Usage: $CMDNAME [options] [username]"
- echo ""
+ echo "$CMDNAME removes a PostgreSQL user."
+ echo
+ echo "Usage:"
+ echo " $CMDNAME [options] [username]"
+ echo
+ echo "Options:"
echo " -h, --host=HOSTNAME Database server host"
echo " -p, --port=PORT Database server port"
echo " -U, --username=USERNAME Username to connect as (not the one to drop)"
echo " -W, --password Prompt for password to connect"
echo " -i, --interactive Prompt before deleting anything"
-#??? echo " -e, --echo "
- echo " -q, --quiet Don't write any messages"
+ echo " -e, --echo Show the query being sent to the backend"
+ echo " -q, --quiet Don't write any messages"
+ echo
+ echo "Report bugs to <pgsql-bugs@postgresql.org>."
exit 0
fi
if [ "$forcedel" = f ]; then
- echo "User \"$DelUser\" and any owned databases will be permanently deleted."
+ echo "User \"$DelUser\" will be permanently deleted."
$ECHO_N "Are you sure? (y/n) "$ECHO_C
read REPLY
DelUser=`echo $DelUser | sed 's/\"/\\\"/g'`
-psql $PSQLOPT -d template1 -c "DROP USER \"$DelUser\""
+${PATHNAME}psql $PSQLOPT -d template1 -c "DROP USER \"$DelUser\""
if [ $? -ne 0 ]; then
echo "$CMDNAME: deletion of user \"$DelUser\" failed"
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/vacuumdb,v 1.8 2000/01/12 19:36:36 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/vacuumdb,v 1.9 2000/01/19 20:08:36 petere Exp $
#
#-------------------------------------------------------------------------
CMDNAME=`basename $0`
+PATHNAME=`echo $0 | sed "s,$CMDNAME\$,,"`
PSQLOPT=
verbose=
table=
dbname=
alldb=
+quiet=0
while [ $# -gt 0 ]
do
--port=*)
PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'`
;;
- --user|--username|-U)
- PSQLOPT="$PSQLOPT -U '$2'"
+ --username|-U)
+ PSQLOPT="$PSQLOPT -U $2"
shift;;
-U*)
PSQLOPT="$PSQLOPT $1"
;;
- --user=*)
- PSQLOPT="$PSQLOPT -U "`echo $1 | sed 's/^--user=//'`
- ;;
--username=*)
PSQLOPT="$PSQLOPT -U "`echo $1 | sed 's/^--username=//'`
;;
PSQLOPT="$PSQLOPT -W"
;;
--echo|-e)
- PSQLOPT="$PSQLOPT -e"
+ ECHOOPT="-e"
;;
--quiet|-q)
- PSQLOPT="$PSQLOPT -o /dev/null"
+ ECHOOPT="$ECHOOPT -o /dev/null"
+ quiet=1
;;
- --dbname|--database|-d)
+ --dbname|-d)
dbname="$2"
shift;;
-d*)
--dbname=*)
dbname=`echo $1 | sed 's/^--dbname=//'`
;;
- --database=*)
- dbname=`echo $1 | sed 's/^--database=//'`
- ;;
# options converted into SQL command
--analyze|-z)
- analyze="ANALYZE "
+ analyze="ANALYZE"
;;
--all|-a)
alldb=Y
table=`echo $1 | sed 's/^--table=//'`
;;
--verbose|-v)
- verbose="VERBOSE "
+ verbose="VERBOSE"
;;
-*)
- echo "$CMDNAME: unrecognized option: $1"
+ echo "$CMDNAME: invalid option: $1"
echo "Try -? for help."
exit 1
;;
done
if [ "$usage" ]; then
- echo "Usage: $CMDNAME [options] [dbname]"
- echo ""
+ echo "$CMDNAME cleans and analyzes a PostgreSQL database."
+ echo
+ echo "Usage:"
+ echo " $CMDNAME [options] [dbname]"
+ echo
+ echo "Options:"
echo " -h, --host=HOSTNAME Database server host"
echo " -p, --port=PORT Database server port"
echo " -U, --username=USERNAME Username to connect as"
echo " -z, --analyze Update optimizer hints"
echo " -t, --table='TABLE[(columns)]' Vacuum specific table only"
echo " -v, --verbose Write a lot of output"
-#??? echo " -e, --echo "
+ echo " -e, --echo Show the command being sent to the backend"
echo " -q, --quiet Don't write any output"
+ echo
+ echo "Report bugs to <pgsql-bugs@postgresql.org>."
exit 0
fi
echo "$CMDNAME: cannot vacuum all databases and a specific one at the same time"
exit 1
fi
- dbname="`psql $PSQLOPT -q -t -A -d template1 -c 'SELECT datname FROM pg_database'`"
-fi
+ dbname=`${PATHNAME}psql $PSQLOPT -q -t -A -d template1 -c 'SELECT datname FROM pg_database'`
-if [ -z "$dbname" ]; then
+elif [ -z "$dbname" ]; then
echo "$CMDNAME: missing required argument database name"
echo "Try -? for help."
exit 1
for db in $dbname
do
- psql $PSQLOPT -c "vacuum $verbose $analyze $table" -d $dbname
+ [ "$alldb" -a "$quiet" -ne 1 ] && echo "Vacuuming $db"
+ ${PATHNAME}psql $PSQLOPT $ECHOOPT -c "VACUUM $verbose $analyze $table" -d $db
done
if [ $? -ne 0 ]; then