33# pg_upgrade: update a database without needing a full dump/reload cycle.
44# CAUTION: Read the manual page before trying to use this!
55
6- # $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/pg_upgrade,v 1.25 2002/01/1105:54:59 momjian Exp $
6+ # $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/pg_upgrade,v 1.26 2002/01/1106:08:02 momjian Exp $
77#
88# NOTE: we must be sure to update the version-checking code a few dozen lines
99# below for each new PostgreSQL release.
@@ -99,6 +99,7 @@ case "$SRC_VERSION" in
9999esac
100100
101101pg_resetxlog2> /dev/null
102+ # file not found status is normally 127, not 1
102103if [" $? " -ne 1 ]
103104then echo " Unable to find pg_resetxlog in path.
104105Install it from pgsql/contrib/pg_resetxlog and continue.; exiting" 1>&2
@@ -241,13 +242,15 @@ done
241242
242243
243244# Set this so the next VACUUM sets the old row XID's as "frozen"
245+ # Commit status already updated by vacuum above
246+
244247pg_resetxlog -x" $XID " data
245248if [" $? " -ne 0 ]
246249then echo " Unable to set new XID.; exiting" 1>&2
247250exit 1
248251fi
249252
250- # set last checkpoint location from old database
253+ # Set last checkpoint location from old database
251254
252255CHKPOINT=` pg_resetxlog -n" $OLDDIR " | grep" checkpoint location:" |
253256awk -F' *' ' {print $4}' `
@@ -256,6 +259,8 @@ thenecho "Unable to get old checkpoint location.; exiting" 1>&2
256259exit 1
257260fi
258261
262+ # Set checkpoint location of new database
263+
259264pg_resetxlog -l` echo" $CHKPOINT | tr '/' ' '` data
260265if [" $? " -ne 0 ]
261266then echo " Unable to set new checkpoint location.; exiting" 1>&2
@@ -271,6 +276,7 @@ thenecho "Unable to restart database server.; exiting" 1>&2
271276fi
272277
273278# Set sequence values for 7.1-version sequences, which were int4.
279+
274280if [" $SRC_VERSION " = " 7.1" ]
275281else echo " Set int8 sequence values from 7.1..."
276282