Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
3b7d13a6
Commit
3b7d13a6
authored
Aug 30, 1998
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make old db directory configurable.
parent
2739315a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
17 deletions
+24
-17
src/bin/pg_dump/pg_upgrade
src/bin/pg_dump/pg_upgrade
+18
-11
src/man/pg_upgrade.1
src/man/pg_upgrade.1
+6
-6
No files found.
src/bin/pg_dump/pg_upgrade
View file @
3b7d13a6
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
trap "rm -f /tmp/$$" 0 1 2 3 15
trap "rm -f /tmp/$$" 0 1 2 3 15
if [ "$#" -eq 0 ]
if [ "$#" -eq 0 ]
then echo "Usage: $0 [-f inputfile] database" 1>&2
then echo "Usage: $0 [-f inputfile]
old_data_dir
database" 1>&2
exit 1
exit 1
fi
fi
...
@@ -16,12 +16,13 @@ then INPUT="$2"
...
@@ -16,12 +16,13 @@ then INPUT="$2"
else INPUT=""
else INPUT=""
fi
fi
if [ "$#" -ne
1
]
if [ "$#" -ne
2
]
then echo "Usage: $0 [-f input_file] database" 1>&2
then echo "Usage: $0 [-f input_file]
old_data_dir
database" 1>&2
exit 1
exit 1
fi
fi
DATABASE="$1"
OLDDIR="$1"
DATABASE="$2"
# check things
# check things
...
@@ -30,8 +31,13 @@ then echo "$0 must be run from the top of the postgres directory tree." 1>&2
...
@@ -30,8 +31,13 @@ then echo "$0 must be run from the top of the postgres directory tree." 1>&2
exit 1
exit 1
fi
fi
if [ ! -d "./data.upgrade" ]
if [ ! -d "./$OLDDIR" ]
then echo "You must rename your old /data directory to /data.upgrade and run initdb." 1>&2
then echo "You must rename your old /data directory to /$OLDDIR and run initdb." 1>&2
exit 1
fi
if [ ! -d "./$OLDDIR/data/base/$DATABASE" ]
then echo "There is not database $DATABASE in ./$OLDDIR/data/base." 1>&2
exit 1
exit 1
fi
fi
...
@@ -48,11 +54,12 @@ fi
...
@@ -48,11 +54,12 @@ fi
# do I need to create a database?
# do I need to create a database?
if [ "$DATABASE" != "template1" ]
if [ "$DATABASE" != "template1" ]
then destroydb "$DATABASE"
then echo "Dropping and recreating database $DATABASE." 1>&2
destroydb "$DATABASE" >/dev/null 2>&1
createdb "$DATABASE"
createdb "$DATABASE"
fi
fi
# remove COPY statements, preserve pgdump_oid setting from pg_dumpall
# remove
any
COPY statements, preserve pgdump_oid setting from pg_dumpall
cat $INPUT | awk ' {
cat $INPUT | awk ' {
if (toupper($0) ~ /^COPY / &&
if (toupper($0) ~ /^COPY / &&
...
@@ -71,9 +78,9 @@ for DIR in data/base/*
...
@@ -71,9 +78,9 @@ for DIR in data/base/*
do
do
BASEDIR="`basename $DIR`"
BASEDIR="`basename $DIR`"
if [ -d "$DIR" -a \
if [ -d "$DIR" -a \
-d "
data.upgrade
/$DIR" -a \
-d "
$OLDDIR
/$DIR" -a \
\( "$DATABASE" = "$BASEDIR" -o "$DATABASE" = "template1" \) ]
\( "$DATABASE" = "$BASEDIR" -o "$DATABASE" = "template1" \) ]
then for FILE in
data.upgrade
/$DIR/*
then for FILE in
$OLDDIR
/$DIR/*
do
do
BASEFILE="`basename $FILE`"
BASEFILE="`basename $FILE`"
if [ `expr "$BASEFILE" : "pg_"` -ne 3 -a \
if [ `expr "$BASEFILE" : "pg_"` -ne 3 -a \
...
@@ -84,4 +91,4 @@ do
...
@@ -84,4 +91,4 @@ do
fi
fi
done
done
echo "You may removed the
data.upgrade directory with 'rm -r data.upgrade
'."
echo "You may removed the
$OLDDIR directory with 'rm -r $OLDDIR
'."
src/man/pg_upgrade.1
View file @
3b7d13a6
.\" This is -*-nroff-*-
.\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here....
.\" XXX standard disclaimer belongs here....
.\" $Header: /cvsroot/pgsql/src/man/Attic/pg_upgrade.1,v 1.
2 1998/08/30 05:25:47
momjian Exp $
.\" $Header: /cvsroot/pgsql/src/man/Attic/pg_upgrade.1,v 1.
3 1998/08/30 13:14:00
momjian Exp $
.TH pg_upgrade UNIX 1/20/96 PostgreSQL PostgreSQL
.TH pg_upgrade UNIX 1/20/96 PostgreSQL PostgreSQL
.SH NAME
.SH NAME
pg_upgrade - allows upgrade from a previous release without reloading data
pg_upgrade - allows upgrade from a previous release without reloading data
.SH SYNOPSIS
.SH SYNOPSIS
.BR pg_upgrade
.BR pg_upgrade
[-f input_file] database
[-f input_file]
old_data_dir
database
.SH DESCRIPTION
.SH DESCRIPTION
.IR "pg_upgrade"
.IR "pg_upgrade"
is a utility for upgrading from a previous PostgreSQL release
is a utility for upgrading from a previous PostgreSQL release
...
@@ -23,7 +23,7 @@ while perserving the max system oid.
...
@@ -23,7 +23,7 @@ while perserving the max system oid.
.PP
.PP
Then rename (using
Then rename (using
.IR mv )
.IR mv )
your old pgsql /data directory to /data.
upgrade
and do a
your old pgsql /data directory to /data.
old
and do a
.IR "make install"
.IR "make install"
to install the new binaries.
to install the new binaries.
Then run
Then run
...
@@ -35,21 +35,21 @@ database containing the system tables for the new release.
...
@@ -35,21 +35,21 @@ database containing the system tables for the new release.
to the pgsql main directory, and type:
to the pgsql main directory, and type:
.nf
.nf
pg_upgrade -f db.out template1
pg_upgrade -f db.out
data.old
template1
.fi
.fi
The system will do some checking to make sure everything is properly
The system will do some checking to make sure everything is properly
configured, and run your
configured, and run your
.IR db.out
.IR db.out
script to create all the databases and tables you had, but with no data.
script to create all the databases and tables you had, but with no data.
It will then move the data files from /data.
upgrade
into the proper
It will then move the data files from /data.
old
into the proper
.IR /data
.IR /data
directory.
directory.
You can then start the
You can then start the
.IR postmaster
.IR postmaster
and check out the data.
and check out the data.
You can delete the
You can delete the
.IR /data.
upgrade
.IR /data.
old
directory when you are finished.
directory when you are finished.
.PP
.PP
It can also be used for individual databases.
It can also be used for individual databases.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment