Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
c870be65
Commit
c870be65
authored
26 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
New pg_upgrade command.
parent
7d7adf24
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/bin/pg_dump/Makefile.in
+2
-1
2 additions, 1 deletion
src/bin/pg_dump/Makefile.in
src/bin/pg_dump/pg_upgrade
+87
-0
87 additions, 0 deletions
src/bin/pg_dump/pg_upgrade
src/man/pg_upgrade.1
+56
-0
56 additions, 0 deletions
src/man/pg_upgrade.1
with
145 additions
and
1 deletion
src/bin/pg_dump/Makefile.in
+
2
−
1
View file @
c870be65
...
...
@@ -7,7 +7,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/Makefile.in,v 1.
9
1998/0
4/06 16:50:46
momjian Exp $
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/Makefile.in,v 1.
10
1998/0
8/30 05:06:53
momjian Exp $
#
#-------------------------------------------------------------------------
...
...
@@ -41,6 +41,7 @@ submake:
install
:
pg_dump
$(
INSTALL
)
$(
INSTL_EXE_OPTS
)
pg_dump
$(
BINDIR
)
/pg_dump
$(
INSTALL
)
$(
INSTL_EXE_OPTS
)
pg_dumpall
$(
BINDIR
)
/pg_dumpall
$(
INSTALL
)
$(
INSTL_EXE_OPTS
)
pg_upgrade
$(
BINDIR
)
/pg_upgrade
depend dep
:
$(
CC
)
-MM
$(
CFLAGS
)
*
.c
>
depend
...
...
This diff is collapsed.
Click to expand it.
src/bin/pg_dump/pg_upgrade
0 → 100755
+
87
−
0
View file @
c870be65
:
trap "rm -f /tmp/$$" 0 1 2 3 15
if [ "$#" -eq 0 ]
then echo "Usage: $0 [-f inputfile] database" 1>&2
exit 1
fi
if [ "X$1" = "X-f" ]
then INPUT="$2"
shift 2
if [ ! -f "$INPUT" ]
then echo "$INPUT does not exist" 1>&2
exit 1
fi
else INPUT=""
fi
if [ "$#" -ne 1 ]
then echo "Usage: $0 [-f input_file] database" 1>&2
exit 1
fi
DATABASE="$1"
# check things
if [ ! -f "./lib/global1.bki.source" ]
then echo "$0 must be run from the top of the postgres directory tree." 1>&2
exit 1
fi
if [ ! -d "./data.upgrade" ]
then echo "You must rename your old /data directory to /data.upgrade and run initdb." 1>&2
exit 1
fi
if [ ! -d "./data" ]
then echo "You must run initdb to create the template1 database." 1>&2
exit 1
fi
if [ ! -d "./data/base/template1" ]
then echo "$0 must be run as the postgres superuser." 1>&2
exit 1
fi
# do I need to create a database?
if [ "$DATABASE" != "template1" ]
then destroydb "$DATABASE"
createdb "$DATABASE"
fi
# remove COPY statements, preserve pgdump_oid setting from pg_dumpall
cat $INPUT | awk ' {
if (toupper($0) ~ /^COPY / &&
toupper($0) !~ /^COPY[ ]*PGDUMP_OID/ )
while (getline $0 > 0 && $0 != "\\.")
;
else print $0;
}' >/tmp/$$
#create empty tables/indexes
psql "$DATABASE" <"/tmp/$$"
set -x
for DIR in data/base/*
do
BASEDIR="`basename $DIR`"
if [ -d "$DIR" -a \
-d "data.upgrade/$DIR" -a \
\( "$DATABASE" = "$BASEDIR" -o "$DATABASE" = "template1" \) ]
then for FILE in data.upgrade/$DIR/*
do
BASEFILE="`basename $FILE`"
if [ `expr "$BASEFILE" : "pg_"` -ne 3 -a \
"$BASEFILE" != "PG_VERSION" ]
then mv $FILE $DIR
fi
done
fi
done
echo "You may removed the data.upgrade directory with 'rm -r data.upgrade'."
This diff is collapsed.
Click to expand it.
src/man/pg_upgrade.1
0 → 100644
+
56
−
0
View file @
c870be65
.\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here....
.\" $Header: /cvsroot/pgsql/src/man/Attic/pg_upgrade.1,v 1.1 1998/08/30 05:06:54 momjian Exp $
.TH pg_upgrade UNIX 1/20/96 PostgreSQL PostgreSQL
.SH NAME
pg_upgrade - allows upgrade from a previous release without reloading data
.SH SYNOPSIS
.BR pg_upgrade
[-f input_file] database
.SH DESCRIPTION
.IR "pg_upgrade"
is a utility for upgrading from a previous PostgreSQL release
without reloading all the data.
First, to be safe, back up your data directory.
Then, use:
.nf
pg_dumpall -s -o >db.out
.fi
to dump out your old database definitions without data,
while perserving the max system oid.
.PP
Then rename (using
.IR mv )
your old pgsql /data directory to /data.upgrade and do a
.IR "make install"
to install the new binaries.
Then run
.IR initdb
to create a new
.IR template1
database containing the system tables for the new release.
.IR cd
to the pgsql main directory, and type:
.nf
pg_upgrade -f db.out template1
.fi
The system will do some checking to make sure everything is properly
configured, and run your
.IR db.out
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
.IR /data
directory.
You can then start the
.IR postmaster
and check out the data.
You can delete the
.IR /data.upgrade
directory when you are finished.
.fi
.SH "SEE ALSO"
pg_dumpall(1).
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment