Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/scripts')
-rw-r--r--src/bin/scripts/createdb14
-rw-r--r--src/bin/scripts/createlang.sh38
-rw-r--r--src/bin/scripts/createuser15
-rw-r--r--src/bin/scripts/dropdb12
-rw-r--r--src/bin/scripts/droplang36
-rw-r--r--src/bin/scripts/dropuser8
-rw-r--r--src/bin/scripts/vacuumdb16
7 files changed, 79 insertions, 60 deletions
diff --git a/src/bin/scripts/createdb b/src/bin/scripts/createdb
index fd07e27292a..3601811b249 100644
--- a/src/bin/scripts/createdb
+++ b/src/bin/scripts/createdb
@@ -11,7 +11,7 @@
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createdb,v 1.8 2000/02/10 20:08:58 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createdb,v 1.9 2000/11/11 22:59:48 petere Exp $
#
#-------------------------------------------------------------------------
@@ -88,8 +88,8 @@ do
MB=`echo $1 | sed 's/^--encoding=//'`
;;
-*)
- echo "$CMDNAME: invalid option: $1"
- echo "Try -? for help."
+ echo "$CMDNAME: invalid option: $1" 1>&2
+ echo "Try '$CMDNAME -?' for help." 1>&2
exit 1
;;
*)
@@ -118,6 +118,8 @@ if [ "$usage" ]; then
echo " -W, --password Prompt for password"
echo " -e, --echo Show the query being sent to the backend"
echo " -q, --quiet Don't write any messages"
+ echo
+ echo "By default, a database with the same name as the current user is created."
echo
echo "Report bugs to <pgsql-bugs@postgresql.org>."
exit 0
@@ -129,7 +131,7 @@ then
mbcode=`${PATHNAME}pg_encoding "$MB"`
if [ -z "$mbcode" ]
then
- echo "$CMDNAME: \"$MB\" is not a valid encoding name"
+ echo "$CMDNAME: \"$MB\" is not a valid encoding name" 1>&2
exit 1
fi
fi
@@ -155,7 +157,7 @@ withstring=
${PATHNAME}psql $PSQLOPT -d template1 -c "CREATE DATABASE \"$dbname\"$withstring"
if [ $? -ne 0 ]; then
- echo "$CMDNAME: database creation failed"
+ echo "$CMDNAME: database creation failed" 1>&2
exit 1
fi
@@ -166,7 +168,7 @@ dbcomment=`echo $dbcomment | sed "s/'/\\\\\'/g"`
${PATHNAME}psql $PSQLOPT -d template1 -c "COMMENT ON DATABASE \"$dbname\" IS '$dbcomment'"
if [ $? -ne 0 ]; then
- echo "$CMDNAME: comment creation failed (database was created)"
+ echo "$CMDNAME: comment creation failed (database was created)" 1>&2
exit 1
fi
diff --git a/src/bin/scripts/createlang.sh b/src/bin/scripts/createlang.sh
index 145c83f2f56..4275dc6e93f 100644
--- a/src/bin/scripts/createlang.sh
+++ b/src/bin/scripts/createlang.sh
@@ -8,7 +8,7 @@
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.16 2000/09/29 17:17:34 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.17 2000/11/11 22:59:48 petere Exp $
#
#-------------------------------------------------------------------------
@@ -98,8 +98,8 @@ do
;;
-*)
- echo "$CMDNAME: invalid option: $1"
- echo "Try -? for help."
+ echo "$CMDNAME: invalid option: $1" 1>&2
+ echo "Try '$CMDNAME -?' for help." 1>&2
exit 1
;;
*)
@@ -121,7 +121,7 @@ if [ "$usage" ]; then
echo "$CMDNAME installs a procedural language into a PostgreSQL database."
echo
echo "Usage:"
- echo " $CMDNAME [options] [langname [dbname]]"
+ echo " $CMDNAME [options] [langname] dbname"
echo
echo "Options:"
echo " -h, --host=HOSTNAME Database server host"
@@ -132,6 +132,9 @@ if [ "$usage" ]; then
echo " -L, --pglib=DIRECTORY Find language interpreter file in DIRECTORY"
echo " -l, --list Show a list of currently installed languages"
echo
+ echo "If 'langname' is not specified, you will be prompted interactively."
+ echo "A database name must be specified."
+ echo
echo "Report bugs to <pgsql-bugs@postgresql.org>."
exit 0
fi
@@ -141,8 +144,8 @@ fi
# Check that we have a database
# ----------
if [ -z "$dbname" ]; then
- echo "$CMDNAME: missing required argument database name"
- echo "Try -? for help."
+ echo "$CMDNAME: missing required argument database name" 1>&2
+ echo "Try '$CMDNAME -?' for help." 1>&2
exit 1
fi
@@ -200,8 +203,8 @@ case "$langname" in
object="plperl"
;;
*)
- echo "$CMDNAME: unsupported language '$langname'"
- echo "Supported languages are 'plpgsql', 'pltcl', and 'plperl'."
+ echo "$CMDNAME: unsupported language '$langname'" 1>&2
+ echo "Supported languages are 'plpgsql', 'pltcl', 'pltclu', and 'plperl'." 1>&2
exit 1
;;
esac
@@ -213,14 +216,17 @@ DLSUFFIX='@DLSUFFIX@'
# in PGLIB
# ----------
if [ ! -f "$PGLIB/$object$DLSUFFIX" ]; then
- echo "$CMDNAME: cannot find the file \`$PGLIB/$langname$DLSUFFIX'"
+ (
+ echo "$CMDNAME: cannot find the file '$PGLIB/$langname$DLSUFFIX'"
echo ""
- echo "This file contains the call handler for $lancomp. By default,"
+ echo "This file contains the call handler for $lancomp. By default,"
echo "only PL/pgSQL is built and installed; other languages must be"
echo "explicitly enabled at configure time."
echo ""
echo "To install PL/Tcl, make sure the option --with-tcl is given to"
- echo "configure, then recompile and install."
+ echo "configure, then recompile and install. To install PL/Perl use"
+ echo "--with-perl."
+ ) 1>&2
exit 1
fi
@@ -232,11 +238,11 @@ PSQL="${PATHNAME}psql -A -t -q $PSQLOPT -d $dbname -c"
# ----------
res=`$PSQL "SELECT oid FROM pg_language WHERE lanname = '$langname'"`
if [ $? -ne 0 ]; then
- echo "$CMDNAME: external error"
+ echo "$CMDNAME: external error" 1>&2
exit 1
fi
if [ "$res" ]; then
- echo "$CMDNAME: '$langname' is already installed in database $dbname"
+ echo "$CMDNAME: '$langname' is already installed in database $dbname" 1>&2
# separate exit status for "already installed"
exit 2
fi
@@ -246,7 +252,7 @@ fi
# ----------
res=`$PSQL "SELECT oid FROM pg_proc WHERE proname = '$handler'"`
if [ ! -z "$res" ]; then
- echo "$CMDNAME: A function named '$handler' already exists. Installation aborted."
+ echo "$CMDNAME: A function named '$handler' already exists. Installation aborted." 1>&2
exit 1
fi
@@ -255,13 +261,13 @@ fi
# ----------
$PSQL "CREATE FUNCTION $handler () RETURNS OPAQUE AS '$PGLIB/${object}$DLSUFFIX' LANGUAGE 'newC'"
if [ $? -ne 0 ]; then
- echo "$CMDNAME: language installation failed"
+ echo "$CMDNAME: language installation failed" 1>&2
exit 1
fi
$PSQL "CREATE ${trusted}PROCEDURAL LANGUAGE '$langname' HANDLER $handler LANCOMPILER '$lancomp'"
if [ $? -ne 0 ]; then
- echo "$CMDNAME: language installation failed"
+ echo "$CMDNAME: language installation failed" 1>&2
exit 1
fi
diff --git a/src/bin/scripts/createuser b/src/bin/scripts/createuser
index cba8cd20280..62c674d99e6 100644
--- a/src/bin/scripts/createuser
+++ b/src/bin/scripts/createuser
@@ -8,7 +8,7 @@
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createuser,v 1.11 2000/06/12 03:40:49 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createuser,v 1.12 2000/11/11 22:59:48 petere Exp $
#
# Note - this should NOT be setuid.
#
@@ -109,8 +109,8 @@ do
PwPrompt=t
;;
-*)
- echo "$CMDNAME: invalid option: $1"
- echo "Try -? for help."
+ echo "$CMDNAME: invalid option: $1" 1>&2
+ echo "Try '$CMDNAME -?' for help." 1>&2
exit 1
;;
*)
@@ -140,13 +140,16 @@ if [ "$usage" ]; then
echo " -e, --echo Show the query being sent to the backend"
echo " -q, --quiet Don't write any messages"
echo
+ echo "If one of -d, -D, -a, -A, and 'username' is not specified, you will"
+ echo "be prompted interactively."
+ echo
echo "Report bugs to <pgsql-bugs@postgresql.org>."
exit 0
fi
if [ "$SysID" ]; then
if [ "$SysID" != "`echo $SysID | sed 's/[^0-9]//g'`" ]; then
- echo "$CMDNAME: user sysid must be a positive number"
+ echo "$CMDNAME: user sysid must be a positive number" 1>&2
exit 1
fi
fi
@@ -176,7 +179,7 @@ if [ "$PwPrompt" ]; then
stty echo >/dev/null 2>&1
echo
if [ "$FirstPw" != "$SecondPw" ]; then
- echo "Passwords didn't match."
+ echo "Passwords didn't match." 1>&2
exit 1
fi
Password=$FirstPw
@@ -225,7 +228,7 @@ SUBQUERY=
${PATHNAME}psql -c "$QUERY" -d template1 $PSQLOPT
if [ $? -ne 0 ]; then
- echo "$CMDNAME: creation of user \"$NewUser\" failed"
+ echo "$CMDNAME: creation of user \"$NewUser\" failed" 1>&2
exit 1
fi
diff --git a/src/bin/scripts/dropdb b/src/bin/scripts/dropdb
index 65c8542e897..1bb6f10f253 100644
--- a/src/bin/scripts/dropdb
+++ b/src/bin/scripts/dropdb
@@ -10,7 +10,7 @@
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropdb,v 1.6 2000/01/19 20:08:36 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropdb,v 1.7 2000/11/11 22:59:48 petere Exp $
#
#-------------------------------------------------------------------------
@@ -82,8 +82,8 @@ do
forcedel=f
;;
-*)
- echo "$CMDNAME: invalid option: $1"
- echo "Try -? for help."
+ echo "$CMDNAME: invalid option: $1" 1>&2
+ echo "Try '$CMDNAME -?' for help." 1>&2
exit 1
;;
*)
@@ -114,8 +114,8 @@ if [ "$usage" ]; then
fi
if [ -z "$dbname" ]; then
- echo "$CMDNAME: missing required argument database name"
- echo "Try -? for help."
+ echo "$CMDNAME: missing required argument database name" 1>&2
+ echo "Try '$CMDNAME -?' for help." 1>&2
exit 1
fi
@@ -134,7 +134,7 @@ dbname=`echo $dbname | sed 's/\"/\\\"/g'`
${PATHNAME}psql $PSQLOPT -d template1 -c "DROP DATABASE \"$dbname\""
if [ $? -ne 0 ]; then
- echo "$CMDNAME: database removal failed"
+ echo "$CMDNAME: database removal failed" 1>&2
exit 1
fi
diff --git a/src/bin/scripts/droplang b/src/bin/scripts/droplang
index ece2c5c25d5..3205ad35772 100644
--- a/src/bin/scripts/droplang
+++ b/src/bin/scripts/droplang
@@ -8,7 +8,7 @@
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/droplang,v 1.7 2000/02/09 20:23:26 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/droplang,v 1.8 2000/11/11 22:59:48 petere Exp $
#
#-------------------------------------------------------------------------
@@ -88,8 +88,8 @@ do
;;
-*)
- echo "$CMDNAME: invalid option: $1"
- echo "Try -? for help."
+ echo "$CMDNAME: invalid option: $1" 1>&2
+ echo "Try '$CMDNAME -?' for help." 1>&2
exit 1
;;
*)
@@ -118,6 +118,9 @@ if [ "$usage" ]; then
echo " -d, --dbname=DBNAME Database to remove language from"
echo " -l, --list Show a list of currently installed languages"
echo
+ echo "If 'langname' is not specified, you will be prompted interactively."
+ echo "A database name must be specified."
+ echo
echo "Report bugs to <pgsql-bugs@postgresql.org>."
exit 0
fi
@@ -133,8 +136,8 @@ fi
# Check that we have a database
# ----------
if [ -z "$dbname" ]; then
- echo "$CMDNAME: missing required argument database name"
- echo "Try -? for help."
+ echo "$CMDNAME: missing required argument database name" 1>&2
+ echo "Try '$CMDNAME -?' for help." 1>&2
exit 1
fi
@@ -159,13 +162,17 @@ case "$langname" in
lancomp="PL/Tcl"
handler="pltcl_call_handler"
;;
+ pltclu)
+ lancomp="PL/Tcl (untrusted)"
+ handler="pltclu_call_handler"
+ ;;
plperl)
lancomp="PL/Perl"
handler="plperl_call_handler"
;;
*)
- echo "$CMDNAME: unsupported language '$langname'"
- echo "Supported languages are 'plpgsql', 'pltcl', and 'plperl'."
+ echo "$CMDNAME: unsupported language '$langname'" 1>&2
+ echo "Supported languages are 'plpgsql', 'pltcl', 'pltclu', and 'plperl'." 1>&2
exit 1
;;
esac
@@ -179,11 +186,11 @@ PSQL="${PATHNAME}psql -A -t -q $PSQLOPT -d $dbname -c"
# ----------
res=`$PSQL "SELECT oid FROM pg_language WHERE lanname = '$langname'"`
if [ $? -ne 0 ]; then
- echo "$CMDNAME: external error"
+ echo "$CMDNAME: external error" 1>&2
exit 1
fi
if [ -z "$res" ]; then
- echo "$CMDNAME: '$langname' is not installed in database $dbname"
+ echo "$CMDNAME: '$langname' is not installed in database $dbname" 1>&2
exit 1
fi
@@ -193,12 +200,12 @@ fi
# ----------
res=`$PSQL "SELECT COUNT(proname) FROM pg_proc P, pg_language L WHERE P.prolang = L.oid AND L.lanname = '$langname'"`
if [ $? -ne 0 ]; then
- echo "$CMDNAME: external error"
+ echo "$CMDNAME: external error" 1>&2
exit 1
fi
if [ $res -ne 0 ]; then
- echo "$CMDNAME: There are $res functions/trigger procedures declared in language"
- echo "$lancomp. Language not removed."
+ echo "$CMDNAME: There are $res functions/trigger procedures declared in language" 1>&2
+ echo "$lancomp. Language not removed." 1>&2
exit 1
fi
@@ -207,14 +214,13 @@ fi
# ----------
$PSQL "DROP PROCEDURAL LANGUAGE '$langname'"
if [ $? -ne 0 ]; then
- echo "$CMDNAME: language removal failed"
+ echo "$CMDNAME: language removal failed" 1>&2
exit 1
fi
$PSQL "DROP FUNCTION $handler()"
if [ $? -ne 0 ]; then
- echo "$CMDNAME: language removal failed"
+ echo "$CMDNAME: language removal failed" 1>&2
exit 1
fi
-echo "Ok"
exit 0
diff --git a/src/bin/scripts/dropuser b/src/bin/scripts/dropuser
index 3a33c1f9cde..81a00f9c1c8 100644
--- a/src/bin/scripts/dropuser
+++ b/src/bin/scripts/dropuser
@@ -8,7 +8,7 @@
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropuser,v 1.6 2000/01/19 20:08:36 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropuser,v 1.7 2000/11/11 22:59:48 petere Exp $
#
# Note - this should NOT be setuid.
#
@@ -84,8 +84,8 @@ do
forcedel=f
;;
-*)
- echo "$CMDNAME: invalid option: $1"
- echo "Try -? for help."
+ echo "$CMDNAME: invalid option: $1" 1>&2
+ echo "Try '$CMDNAME -?' for help." 1>&2
exit 1
;;
*)
@@ -139,7 +139,7 @@ DelUser=`echo $DelUser | sed 's/\"/\\\"/g'`
${PATHNAME}psql $PSQLOPT -d template1 -c "DROP USER \"$DelUser\""
if [ $? -ne 0 ]; then
- echo "$CMDNAME: deletion of user \"$DelUser\" failed"
+ echo "$CMDNAME: deletion of user \"$DelUser\" failed" 1>&2
exit 1
fi
diff --git a/src/bin/scripts/vacuumdb b/src/bin/scripts/vacuumdb
index fcf6d4513ce..af038add8a7 100644
--- a/src/bin/scripts/vacuumdb
+++ b/src/bin/scripts/vacuumdb
@@ -11,7 +11,7 @@
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/vacuumdb,v 1.9 2000/01/19 20:08:36 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/vacuumdb,v 1.10 2000/11/11 22:59:48 petere Exp $
#
#-------------------------------------------------------------------------
@@ -101,8 +101,8 @@ do
;;
-*)
- echo "$CMDNAME: invalid option: $1"
- echo "Try -? for help."
+ echo "$CMDNAME: invalid option: $1" 1>&2
+ echo "Try '$CMDNAME -?' for help." 1>&2
exit 1
;;
*)
@@ -131,20 +131,22 @@ if [ "$usage" ]; then
echo " -e, --echo Show the command being sent to the backend"
echo " -q, --quiet Don't write any output"
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"
+ 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'`
elif [ -z "$dbname" ]; then
- echo "$CMDNAME: missing required argument database name"
- echo "Try -? for help."
+ echo "$CMDNAME: missing required argument database name" 1>&2
+ echo "Try '$CMDNAME -?' for help." 1>&2
exit 1
fi
@@ -155,7 +157,7 @@ do
done
if [ $? -ne 0 ]; then
- echo "$CMDNAME: vacuum failed"
+ echo "$CMDNAME: vacuum failed" 1>&2
exit 1
fi