mirror of
https://github.com/postgres/postgres.git
synced 2025-11-01 21:31:19 +03:00
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
This commit is contained in:
@@ -2,13 +2,13 @@
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# dropuser--
|
||||
# Utility for remocing a user from the PostgreSQL database.
|
||||
# Utility for removing a user from the PostgreSQL database.
|
||||
#
|
||||
# Copyright (c) 1994, Regents of the University of California
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropuser,v 1.2 1999/12/05 20:52:54 momjian Exp $
|
||||
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropuser,v 1.3 1999/12/07 22:41:44 momjian Exp $
|
||||
#
|
||||
# Note - this should NOT be setuid.
|
||||
#
|
||||
@@ -17,6 +17,7 @@
|
||||
CMDNAME=`basename $0`
|
||||
PSQLOPT=
|
||||
forcedel=t
|
||||
DelUser=
|
||||
|
||||
# Check for echo -n vs echo \c
|
||||
|
||||
@@ -29,6 +30,7 @@ else
|
||||
ECHO_C='\c'
|
||||
fi
|
||||
|
||||
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
@@ -40,17 +42,38 @@ do
|
||||
--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;;
|
||||
# Uncomment these lines if you need the -U and -W options.
|
||||
# They are confusing in this context, however.
|
||||
# --user|--username|-U)
|
||||
# PSQLOPT="$PSQLOPT -U $2"
|
||||
# shift;;
|
||||
# --password|-W)
|
||||
# PSQLOPT="$PSQLOPT -W"
|
||||
# ;;
|
||||
-p*)
|
||||
PSQLOPT="$PSQLOPT $1"
|
||||
;;
|
||||
--port=*)
|
||||
PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'`
|
||||
;;
|
||||
# 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'"
|
||||
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)
|
||||
PSQLOPT="$PSQLOPT -e"
|
||||
;;
|
||||
@@ -76,7 +99,7 @@ done
|
||||
# Help
|
||||
|
||||
if [ "$usage" ]; then
|
||||
echo "Usage: $CMDNAME [-h <server>] [-p <port>] [-i] [username]"
|
||||
echo "Usage: $CMDNAME [-h server] [-p port] [-i] [username]"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -84,7 +107,7 @@ fi
|
||||
|
||||
if [ -z "$DelUser" ]; then
|
||||
$ECHO_N "Enter name of user to delete: "$ECHO_C
|
||||
read NewUser
|
||||
read DelUser
|
||||
[ $? -ne 0 ] && exit 1
|
||||
fi
|
||||
|
||||
@@ -99,6 +122,8 @@ if [ "$forcedel" = f ]; then
|
||||
fi
|
||||
|
||||
|
||||
DelUser=`echo $DelUser | sed 's/\"/\\\"/g'`
|
||||
|
||||
psql $PSQLOPT -d template1 -c "DROP USER \"$DelUser\""
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
|
||||
Reference in New Issue
Block a user