Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a7cdfdf

Browse files
committed
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.
1 parent 30b2d28 commit a7cdfdf

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/bin/pg_dump/pg_upgrade

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
:
1+
#!/bin/sh
2+
#
3+
# pg_upgrade: update a database without needing a full dump/reload cycle
4+
# CAUTION: read the manual page before trying to use this!
5+
26
trap "rm -f /tmp/$$" 0 1 2 3 15
37

48
if [ "$#" -eq 0 ]
@@ -67,6 +71,11 @@ cat $INPUT | awk ' {
6771

6872
psql "template1" <"/tmp/$$"
6973

74+
if [ $? -ne 0 ]
75+
then echo "psql failed to execute $INPUT script." 1>&2
76+
exit 1
77+
fi
78+
7079
for DIR in data/base/*
7180
do
7281
BASEDIR="`basename $DIR`"
@@ -86,4 +95,4 @@ done
8695
mv $OLDDIR/pg_log data
8796
mv $OLDDIR/pg_variable data
8897

89-
echo "You may removed the $OLDDIR directory with 'rm -r $OLDDIR'."
98+
echo "You may remove the $OLDDIR directory with 'rm -r $OLDDIR'."

0 commit comments

Comments
 (0)