1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-03 09:13:20 +03:00

another round of user interface cleanups

removed pg_id
fixed a few bugs in the scripts
This commit is contained in:
Peter Eisentraut
2000-01-19 20:08:36 +00:00
parent ea1f6e00e6
commit 65e0051843
19 changed files with 161 additions and 282 deletions

View File

@@ -8,13 +8,15 @@
#
#
# 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=
@@ -59,15 +61,12 @@ do
;;
# 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=//'`
;;
@@ -85,7 +84,8 @@ do
forcedel=f
;;
-*)
echo "$CMDNAME: Unrecognized option: $1. Try -? for help."
echo "$CMDNAME: invalid option: $1"
echo "Try -? for help."
exit 1
;;
*)
@@ -97,16 +97,21 @@ done
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
@@ -120,7 +125,7 @@ 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
@@ -131,7 +136,7 @@ fi
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"