Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1b5d8e6

Browse files
committed
Fix recreation of sequence files for 7.2 also because of XID change from
beta4 to beta5.
1 parent 7138a1e commit 1b5d8e6

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/bin/pg_dump/pg_upgrade

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
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.33 2002/01/13 05:36:42 momjian Exp $
6+
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/pg_upgrade,v 1.34 2002/01/13 17:52:00 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.
@@ -70,8 +70,10 @@ make_dbobjoidmap()
7070
WHERE relkind = 'r' OR
7171
relkind = 'i' OR
7272
relkind = 't'\"`"
73-
# Don't move over 7.1 sequences; use setval() file
74-
if [ "$SRC_VERSION" != "7.1" ]
73+
# Don't move over 7.1 int4 sequences; use setval() file.
74+
# Sequence XIDs changed from 7.2beta4 to beta5; don't copy them.
75+
if [ "$SRC_VERSION" != "7.1" -a \
76+
"$SRC_VERSION" != "7.2" ]
7577
then QUERY="$QUERY OR relkind = 'S';";
7678
QUERY="$QUERY;"
7779
fi
@@ -213,8 +215,9 @@ $0 aborted." 1>&2
213215
make_dbobjoidmap > "$INFODIR"/dbobjoidmap
214216

215217
# Generate setval() script for 7.1 because it has int4 sequences
216-
217-
if [ "$SRC_VERSION" = "7.1" ]
218+
# Sequence XIDs changed from 7.2beta4 to beta5; we have to recreate them.
219+
if [ "$SRC_VERSION" = "7.1" -o \
220+
"$SRC_VERSION" = "7.2" ]
218221
then
219222
psql -d template1 -At -c "SELECT datname FROM pg_database" |
220223
grep -v '^template0$' |
@@ -511,8 +514,9 @@ fi
511514

512515
# Set sequence values for 7.1-version sequences, which were int4.
513516

514-
if [ "$SRC_VERSION" = "7.1" ]
515-
then echo "Set int8 sequence values from 7.1..."
517+
if [ "$SRC_VERSION" = "7.1" -o \
518+
"$SRC_VERSION" = "7.2" ]
519+
then echo "Set sequence values..."
516520
psql -d template1 -At < "$INFODIR"/setval
517521
if [ $? -ne 0 ]
518522
then echo "There were errors during int4 sequence restore.

0 commit comments

Comments
 (0)