diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 1998-10-24 20:09:46 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 1998-10-24 20:09:46 +0000 |
commit | a7cdfdf022a66ef76d944cc3a03904a8e53f7e81 (patch) | |
tree | 9de83912d7e9848d516cafd681d674da1942fa70 /src | |
parent | 30b2d287fb544774162e543bff59d7f9ed1be97f (diff) |
Fix pg_upgrade to notice if psql fails to execute the given
script, and not proceed with the update if so.
Also add #!/bin/sh header line.
Diffstat (limited to 'src')
-rwxr-xr-x | src/bin/pg_dump/pg_upgrade | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/bin/pg_dump/pg_upgrade b/src/bin/pg_dump/pg_upgrade index f9f062520a6..26e905bc224 100755 --- a/src/bin/pg_dump/pg_upgrade +++ b/src/bin/pg_dump/pg_upgrade @@ -1,4 +1,8 @@ -: +#!/bin/sh +# +# pg_upgrade: update a database without needing a full dump/reload cycle +# CAUTION: read the manual page before trying to use this! + trap "rm -f /tmp/$$" 0 1 2 3 15 if [ "$#" -eq 0 ] @@ -67,6 +71,11 @@ cat $INPUT | awk ' { psql "template1" <"/tmp/$$" +if [ $? -ne 0 ] +then echo "psql failed to execute $INPUT script." 1>&2 + exit 1 +fi + for DIR in data/base/* do BASEDIR="`basename $DIR`" @@ -86,4 +95,4 @@ done mv $OLDDIR/pg_log data mv $OLDDIR/pg_variable data -echo "You may removed the $OLDDIR directory with 'rm -r $OLDDIR'." +echo "You may remove the $OLDDIR directory with 'rm -r $OLDDIR'." |