From 3a3c1b85a30ba6106c488f64d2b26d83a82d5e3b Mon Sep 17 00:00:00 2001 From: "Marc G. Fournier" Date: Thu, 9 Jul 1998 03:35:39 +0000 Subject: [PATCH] From: Tom Lane I see someone missed an ancient bit of shell-scripting lore: on some older shells, if your script's argument list is empty, then "$@" generates an empty-string word rather than no word at all. You need to write ${1+"$@"} to get the latter behavior. (Read your shell man page to see exactly how that works, but it does the Right Thing on every Bourne shell.) In particular, pg_dumpall fails when invoked without any switches on HPUX 9.*, because pg_dump gets an empty-string argument that it thinks is the name of the database to dump. I expect this bug also affects some other OSes, but couldn't tell you just which ones. Patch attached. --- src/bin/pg_dump/pg_dumpall | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/pg_dump/pg_dumpall b/src/bin/pg_dump/pg_dumpall index 4651987b80..48e313afec 100644 --- a/src/bin/pg_dump/pg_dumpall +++ b/src/bin/pg_dump/pg_dumpall @@ -58,7 +58,7 @@ do echo "${BS}connect template1 $POSTGRES_USER" echo "create database $DATABASE;" echo "${BS}connect $DATABASE $POSTGRES_USER" - pg_dump "$@" $DATABASE + pg_dump ${1+"$@"} $DATABASE if [ "$?" -ne 0 ] then echo "pg_dump failed on $DATABASE, exiting" 1>&2 exit 1