Re: [BUGS] Bug #631: pg_dumpall does not accept -F or -f

2002-04-10 Thread Bruce Momjian

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 -  1.16
--- src/bin/pg_dump/pg_dumpall.sh   11 Apr 2002 04:46:09 -
***
*** 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 "SEL

Re: [BUGS] Bug #631: pg_dumpall does not accept -F or -f

2002-04-10 Thread Bruce Momjian

Peter Eisentraut wrote:
> Bruce Momjian writes:
> 
> > Peter Eisentraut wrote:
> > > > The pg_dumpall script seems to ignore the file and format switches
> > > > that are used with pg_dump.  pg_dumpall always writes to stdout in
> > > > text format.  Also, the -b switch can not be used with pg_dumpall
> > > > since text output is being forced.
> > >
> > > That's not a bug.
> >
> > Peter, can you explain why to the user; it is not clear to me why
> > either, though I have my suspicions, and shouldn't we throw an error to
> > the user when they try it?
> 
> The pg_dumpall reference page explicitly cautions against this situation.

Also, Peter, CVS pg_dumpall is not working for me.  It isn't dumping any
database contents.   This new DATABASES line doesn't work in pg_dumpall:

DATABASES="$DATABASES $DATABASE"

The problem is that this is done inside a 'while' loop, so the value
doesn't get outside the loop.  I tested with BSD/OS sh and bash
2.02.1(2).

#$ X=1
#$ echo 1 2 3 | while read X
> do
> X=2 
> done
#$ echo $X
1

-- 
  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

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



Re: [BUGS] Bug #631: pg_dumpall does not accept -F or -f

2002-04-10 Thread Tom Lane

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.

regards, tom lane

---(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



Re: [BUGS] Bug #631: pg_dumpall does not accept -F or -f

2002-04-10 Thread Bruce Momjian

Peter Eisentraut wrote:
> Bruce Momjian writes:
> 
> > Peter Eisentraut wrote:
> > > > The pg_dumpall script seems to ignore the file and format switches
> > > > that are used with pg_dump.  pg_dumpall always writes to stdout in
> > > > text format.  Also, the -b switch can not be used with pg_dumpall
> > > > since text output is being forced.
> > >
> > > That's not a bug.
> >
> > Peter, can you explain why to the user; it is not clear to me why
> > either, though I have my suspicions, and shouldn't we throw an error to
> > the user when they try it?
> 
> The pg_dumpall reference page explicitly cautions against this situation.

I see that now:

   Any other command line parameters are passed to the under-
   lying pg_dump(1) calls. This is  useful  to  control  some
   aspects of the output format, but some options such as -f,
   -t, and dbname should be avoided.

However, it seems we should explicitly throw an error if someone tries
to use these flags.

-- 
  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

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



Re: [BUGS] Bug #631: pg_dumpall does not accept -F or -f

2002-04-10 Thread Peter Eisentraut

Bruce Momjian writes:

> Peter Eisentraut wrote:
> > > The pg_dumpall script seems to ignore the file and format switches
> > > that are used with pg_dump.  pg_dumpall always writes to stdout in
> > > text format.  Also, the -b switch can not be used with pg_dumpall
> > > since text output is being forced.
> >
> > That's not a bug.
>
> Peter, can you explain why to the user; it is not clear to me why
> either, though I have my suspicions, and shouldn't we throw an error to
> the user when they try it?

The pg_dumpall reference page explicitly cautions against this situation.

-- 
Peter Eisentraut   [EMAIL PROTECTED]


---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



Re: [BUGS] Bug #631: pg_dumpall does not accept -F or -f

2002-04-10 Thread Bruce Momjian

Peter Eisentraut wrote:
> > The pg_dumpall script seems to ignore the file and format switches
> > that are used with pg_dump.  pg_dumpall always writes to stdout in
> > text format.  Also, the -b switch can not be used with pg_dumpall
> > since text output is being forced.
> 
> That's not a bug.

Peter, can you explain why to the user; it is not clear to me why
either, though I have my suspicions, and shouldn't we throw an error to
the user when they try it?

-- 
  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

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



Re: [BUGS] Bug #631: pg_dumpall does not accept -F or -f

2002-04-10 Thread Peter Eisentraut

> The pg_dumpall script seems to ignore the file and format switches
> that are used with pg_dump.  pg_dumpall always writes to stdout in
> text format.  Also, the -b switch can not be used with pg_dumpall
> since text output is being forced.

That's not a bug.

-- 
Peter Eisentraut   [EMAIL PROTECTED]


---(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



[BUGS] Bug #631: pg_dumpall does not accept -F or -f

2002-04-10 Thread pgsql-bugs

Don Pellegrinio ([EMAIL PROTECTED]) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
pg_dumpall does not accept -F or -f

Long Description
The pg_dumpall script seems to ignore the file and format switches that are used with 
pg_dump.  pg_dumpall always writes to stdout in text format.  Also, the -b switch can 
not be used with pg_dumpall since text output is being forced.

Sample Code


No file was uploaded with this report


---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]