Tom Lane wrote:
> Bruce Momjian <[EMAIL PROTECTED]> writes:
> > However, it seems we should explicitly throw an error if someone tries
> > to use these flags.
>
> I agree with Bruce that it's be friendlier if pg_dumpall did a little
> more checking. Not a real high priority, perhaps.
OK, Donald, I have added this patch to CVS that will return a proper
error message when invalid pg_dumpall options are used. I added the
options mentioned in the pg_dumpall manual page, plus -F (which wasn't
mentioned in the manual page).
The reason -Ft can't be used is that ASCII SQL commands are output by
pg_dumpall, and these can't be merged with non-ASCII pg_dump output
formats.
--
Bruce Momjian | http://candle.pha.pa.us
[EMAIL PROTECTED] | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Index: src/bin/pg_dump/pg_dumpall.sh
===================================================================
RCS file: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.sh,v
retrieving revision 1.16
diff -c -r1.16 pg_dumpall.sh
*** src/bin/pg_dump/pg_dumpall.sh 24 Feb 2002 21:57:23 -0000 1.16
--- src/bin/pg_dump/pg_dumpall.sh 11 Apr 2002 04:46:09 -0000
***************
*** 8,14 ****
#
# $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.sh,v 1.16 2002/02/24 21:57:23
tgl Exp $
! CMDNAME=`basename $0`
# substituted at build
VERSION='@VERSION@'
--- 8,14 ----
#
# $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.sh,v 1.16 2002/02/24 21:57:23
tgl Exp $
! CMDNAME="`basename $0`"
# substituted at build
VERSION='@VERSION@'
***************
*** 21,27 ****
PGPATH=
if echo "$0" | grep '/' > /dev/null 2>&1 ; then
# explicit dir name given
! PGPATH=`echo $0 | sed 's,/[^/]*$,,'` # (dirname command is not portable)
else
# look for it in PATH ('which' command is not portable)
for dir in `echo "$PATH" | sed 's/:/ /g'` ; do
--- 21,27 ----
PGPATH=
if echo "$0" | grep '/' > /dev/null 2>&1 ; then
# explicit dir name given
! PGPATH=`echo "$0" | sed 's,/[^/]*$,,'` # (dirname command is not portable)
else
# look for it in PATH ('which' command is not portable)
for dir in `echo "$PATH" | sed 's/:/ /g'` ; do
***************
*** 78,84 ****
while [ "$#" -gt 0 ] ; do
! case $1 in
--help)
usage=t
break
--- 78,84 ----
while [ "$#" -gt 0 ] ; do
! case "$1" in
--help)
usage=t
break
***************
*** 94,100 ****
connectopts="$connectopts $1"
;;
--host=*)
! connectopts="$connectopts -h "`echo $1 | sed 's/^--host=//'`
;;
--port|-p)
connectopts="$connectopts -p $2"
--- 94,100 ----
connectopts="$connectopts $1"
;;
--host=*)
! connectopts="$connectopts -h `echo $1 | sed 's/^--host=//'`"
;;
--port|-p)
connectopts="$connectopts -p $2"
***************
*** 103,109 ****
connectopts="$connectopts $1"
;;
--port=*)
! connectopts="$connectopts -p "`echo $1 | sed 's/^--port=//'`
;;
--user|--username|-U)
connectopts="$connectopts -U $2"
--- 103,109 ----
connectopts="$connectopts $1"
;;
--port=*)
! connectopts="$connectopts -p `echo $1 | sed 's/^--port=//'`"
;;
--user|--username|-U)
connectopts="$connectopts -U $2"
***************
*** 112,118 ****
connectopts="$connectopts $1"
;;
--user=*|--username=*)
! connectopts="$connectopts -U "`echo $1 | sed 's/^--user[^=]*=//'`
;;
-W|--password)
connectopts="$connectopts -W"
--- 112,118 ----
connectopts="$connectopts $1"
;;
--user=*|--username=*)
! connectopts="$connectopts -U `echo $1 | sed 's/^--user[^=]*=//'`"
;;
-W|--password)
connectopts="$connectopts -W"
***************
*** 125,130 ****
--- 125,134 ----
-g|--globals-only)
globals_only=yes
;;
+ -F*|--format=*|-f|--file=*|-t|--table=*)
+ echo "pg_dump can not process option $1, exiting" 1>&2
+ exit 1
+ ;;
*)
pgdumpextraopts="$pgdumpextraopts $1"
;;
***************
*** 214,225 ****
# We skip databases marked not datallowconn, since we'd be unable to
# connect to them anyway (and besides, we don't want to dump template0).
- DATABASES=""
-
$PSQL -d template1 -At -F ' ' \
-c "SELECT datname, coalesce(usename, (select usename from pg_shadow where
usesysid=(select datdba from pg_database where datname='template0'))),
pg_encoding_to_char(d.encoding), datistemplate, datpath FROM pg_database d LEFT JOIN
pg_shadow u ON (datdba = usesysid) WHERE datallowconn ORDER BY 1;" | \
while read DATABASE DBOWNER ENCODING ISTEMPLATE DBPATH; do
- DATABASES="$DATABASES $DATABASE"
if [ "$DATABASE" != template1 ] ; then
echo
--- 218,226 ----
***************
*** 242,248 ****
fi
done
! for DATABASE in $DATABASES; do
echo "dumping database \"$DATABASE\"..." 1>&2
echo
echo "--"
--- 243,251 ----
fi
done
! $PSQL -d template1 -At -F ' ' \
! -c "SELECT datname FROM pg_database WHERE datallowconn ORDER BY 1;" | \
! while read DATABASE; do
echo "dumping database \"$DATABASE\"..." 1>&2
echo
echo "--"
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly