~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to contrib/pg_upgrade/TESTING

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
contrib/pg_upgrade/TESTING
 
2
 
 
3
The most effective way to test pg_upgrade, aside from testing on user
 
4
data, is by upgrading the PostgreSQL regression database.
 
5
 
 
6
This testing process first requires the creation of a valid regression
 
7
database dump.  Such files contain most database features and are
 
8
specific to each major version of Postgres.
 
9
 
 
10
Here are the steps needed to create a regression database dump file:
 
11
 
 
12
1)  Create and populate the regression database in the old cluster
 
13
    This database can be created by running 'gmake installcheck' from
 
14
    src/test/regression.
 
15
 
 
16
2)  Use pg_dump to dump out the regression database
 
17
    Use the new cluster's pg_dump on the old database to minimize
 
18
    whitespace differences in the diff.
 
19
 
 
20
3)  Adjust the regression database dump file
 
21
 
 
22
    a)  Change CREATE FUNCTION shared object paths to use '$libdir'
 
23
        The old and new cluster will have different shared object paths.
 
24
 
 
25
    d)  Perform the load/dump twice
 
26
        This fixes problems with the ordering of COPY columns for
 
27
        inherited tables.
 
28
 
 
29
    e)  Fix any wrapping format differences
 
30
        Commands like CREATE TRIGGER and ALTER TABLE sometimes have
 
31
        differences.
 
32
 
 
33
    c)  For pre-9.0, change CREATE OR REPLACE LANGUAGE to CREATE LANGUAGE
 
34
 
 
35
    b)  For pre-9.0, remove 'regex_flavor'
 
36
 
 
37
    f)  For pre-9.0, adjust extra_float_digits
 
38
        Postgres 9.0 pg_dump uses extra_float_digits=-2 for pre-9.0
 
39
        databases, and extra_float_digits=-3 for >= 9.0 databases.
 
40
        It is necessary to modify 9.0 pg_dump to always use -3, and
 
41
        modify the pre-9.0 old server to accept extra_float_digits=-3.
 
42
 
 
43
Once the dump is created, it can be repeatedly loaded into the old
 
44
database, upgraded, and dumped out of the new database, and then
 
45
compared to the original version. To test the dump file, perform these
 
46
steps:
 
47
 
 
48
1)  Create the old and new clusters in different directories.
 
49
 
 
50
2)  Copy the regression shared object files into the appropriate /lib
 
51
    directory for old and new clusters.
 
52
 
 
53
3)  Create the regression database in the old server.
 
54
 
 
55
4)  Load the dump file created above into the regression database;
 
56
    check for errors while loading.
 
57
 
 
58
5)  Upgrade the old database to the new major version, as outlined in
 
59
    the pg_upgrade manual section.
 
60
 
 
61
6)  Use pg_dump to dump out the regression database in the new cluster.
 
62
 
 
63
7)  Diff the regression database dump file with the regression dump
 
64
    file loaded into the old server.