Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit692b837

Browse files
committed
Fix pg_upgrade so it vacuums all databases.
1 parent008ef1d commit692b837

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

‎src/bin/pg_dump/pg_upgrade

Lines changed: 10 additions & 9 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.12 1999/09/2816:02:28 momjian Exp $
6+
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/pg_upgrade,v 1.13 1999/09/2818:04:18 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.
@@ -100,23 +100,24 @@ esac
100100

101101

102102
# OK, ready to proceed.
103-
# XXX Do I need to create a database?
104103

105-
# remove any COPY statements, except for the one that loads pg_shadow.
106-
# there shouldn't be any others in there anyway...
104+
# Remove any COPY statements, except for the one that loads pg_shadow.
105+
# There shouldn't be any others in there anyway...
106+
# Also marks rows as committed because when pg_log is replaced with
107+
# the saved version, the transaction statuses may be wrong, so
108+
# vacuum sets the on-row status to the proper value.
107109

108110
cat$INPUT| awk'{
109111
if (toupper($1) == "COPY" && $2 != "pg_shadow")
110112
while (getline $0 > 0 && $0 != "\\.")
111113
;
114+
else if (tolower($1) == "\\connect" &&
115+
tolower($2) == "template1")
116+
printf "VACUUM;\n%s\n", $0;
112117
elseprint $0;
113118
}'>/tmp/$$
114119

115-
# Add a VACUUM command to the end of the pg_dump script. With MVCC,
116-
# this is necessary to ensure that all the rows in the new database's
117-
# system tables will still be considered committed after we overwrite
118-
# pg_log with the old database's commit log...
119-
120+
# We need to vacuum the last database too
120121
echo"VACUUM;">>/tmp/$$
121122

122123
# Create and vacuum empty tables/indexes

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp