Sophie

Sophie

distrib > Mandriva > 7.2 > i586 > media > main-src > by-pkgid > ca404dcceabf913201afa303656c7a28 > files > 1

postgresql-7.0.2-6mdk.src.rpm

README.rpm
-----------------------------------------------------------------------------
Version 2.5, for PostgreSQL 7.0 
Lamar Owen <lamar.owen@wgcr.org> 
-----------------------------------------------------------------------------

Contents:
0.)	Precautionary Statement for RPM packaging
1.)	Introduction and credits
2.)	PostgreSQL RPM packages and rationale
3.)	Upgrading from an older version of PostgreSQL without losing data.
4.)	Regression Testing
5.)	Starting postmaster automatically on startup
6.)	Further Information Resource

----CAUTION-----
-----------------------------------------------------------------------------
Even thought these are the RPM's for the 7.0 final release, there may yet be
minor problems.  Please let me (lamar.owen@wgcr.org) know about any problems
you may find.  I prefer that e-mail be sent to the pgsql-ports@postgresql.org
mailing list rather than my personal e-mail -- or, cc: pgsql-ports at least.

- Make a full backup of your database before you start -- the migration script
  is still being tweaked for 7.0, so don't rely on it yet.

- The database directory has been CHANGED since 6.5.x -- it is now in 
  /var/lib/pgsql/data

- The preferred place for backup databases is now /var/lib/pgsql/backup

- Postmaster logging functionality is being developed and tested, using syslog.
  Default pg_options are set to NOT use syslog, even though patches for syslog
  have been applied.  After a good shake down of Tatsuo's patches, syslog will
  return as the default.

INTRODUCTION
-----------------------------------------------------------------------------
This document exists to explain the layout of the RPM's for PostgreSQL, to 
explain how to migrate from an older version, and to explain WHY it can be
so difficult to upgrade PostgreSQL.

This document is written to be applicable to version 7.0 of PostgreSQL
, which is the current version of the RPM's as of this writing. 

NOTE: The 7.0 RPMs are only being built under RedHat 6.2! They
may or may not work under RedHat 6.0 or 6.1.

CREDITS
-----------------------------------------------------------------------------
Thomas Lockhart, for the vision of a different RPM split, and for allowing me
to go forward with this package.

Uncle George and Ryan Kirkpatrick, for the Alpha patches

Mark Knox for getting armv41 working.

RedHat, for their distribution.

Mike Mascari, for prodding me to get the SPI headers right and for helping
with other details.

Nicolas Huillard, for prodding me with logrotate functionality.

Karl DeBisschop, for testing and for pl/perls's building.

Trond at redhat for bugfixes.

And all the rest!


POSTGRESQL RPM PACKAGES AND RATIONALE.
-----------------------------------------------------------------------------
Two different RPM versions are available starting with 6.5.3-2 -- a version
with locale enabled, and a version without locale.  The non-locale version
is differentiated from the locale version by the addition of the letters 'nl'
after the release digit:  for example, there are 6.5.3-2 RPMs, and there are
6.5.3-2nl non-locale RPMs.  Locale and i18n charmap settings can cause problems
with sorting, even when using the non-locale RPMs.  The file:
/etc/sysconfig/i18n on RedHat 6.1 systems contains settings which may cause
unusual sort orders and other collation issues.

For the 7.0 RPMS, only the locale-enabled version is being built.

Prior to version 6.5, PostgreSQL was packaged in RPM form in three (or four)
packages:

postgresql:		The server and documentation
postgresql-clients:	The client libraries, the cli, and the tcl interface
postgresql-devel:	Development libraries (for the client-side)
postgresql-data:	A sample database -- not shipped with the 6.4 RPMS.

However, it was decided that a different split would be more appropriate for
users.  The new splitup allows more flexibility in installation, as well as
making the new clients into their own packages.  The new packages are:

postgresql:		Some clients and libraries, and documentation
postgresql-server:	Server executables and data files
postgresql-devel:	Client-side development libraries
postgresql-tcl:		TCL/TK client libraries and the pgaccess client
postgresql-perl:	PERL client module
postgresql-python:	The PygreSQL client library
postgresql-odbc:	Linux ODBC client (not required to use ODBC from Win95)
postgresql-jdbc:	JAR of the JDBC client
postgresql-test:	The regression tests and associated files.

For version 7.0, another package is being shipped, and one package has been
trimmed:
postgresql-tk:		Tk client and pgaccess.
postgresql-tcl:		Tcl client and PL ONLY.

Release 7.0-3 includes yet another subpackage, due to its slightly
experimental nature, and due to its inclusion of libperl.so:
postgresql-plperl:	PL/Perl procedural language and libs.

While the repackaging will initially cause some confusion, it makes it
possible  to set up a RedHat linux machine to be only a client -- the server
is no longer required.  The clients were split out -- after all, a person who
needs the perl client may very well not need the tcl client, etc.  And, the
regression tests were added to give some confidence of the suitability of
PostgreSQL, as well as the stability of the server machine.

RPM FILE LOCATIONS.
-----------------------------------------------------------------------------
In compliance with the Linux FHS, the PostgreSQL RPM's install files in a manner
not consistent with most of the PostgreSQL documentation.  According to the
standard PostgreSQL documentation, PostgreSQL is installed under the directory
/usr/local/pgsql, with executables, source, and data existing in various 
subdirectories.

However, the RPM's install the files like this:
Executables:		/usr/bin
Libaries:		/usr/lib
Documentation:		/usr/doc/postgresql-7.0
Contrib:		/usr/doc/postgresql-7.0/contrib
Source:			not installed
Data:			/var/lib/pgsql/data
Backup area:		/var/lib/pgsql/backup
Templates:		/usr/lib/pgsql
Procedural Languages:	/usr/lib/pgsql
Regression Tests:	/usr/lib/pgsql/test/regress
TK client docs:		/usr/doc/postgresql-tk-7.0
Development Headers:	/usr/include/pgsql

While it may seem gratuitous to place these files in different locations, the
FHS requires it -- distributions should not ever touch /usr/local.  It may
also seem like more work to keep track of where everything is -- but, that's
the beauty of RPM -- you don't have to keep track of the files, RPM does it
for you.

UPGRADING.
-----------------------------------------------------------------------------
NOTE: moving your existing data from /var/lib/pgsql to /var/lib/pgsql/data is
not currently automatic -- you will need to do this yourself at this release!
Caveat beta-testor!

The single biggest problem with upgrading PostgreSQL RPM's has been the lack 
of a reasonably automated upgrade process.  PostgreSQL has the property of 
the binary on-disk database format changing between major versions (like 
between 6.3 and 6.4).  However, a change from 6.5 to 6.5.3 does not change 
the on-disk format.

This property (feature, misfeature, bug, whatever) has been a known property of
PostgreSQL since before it was called PostgreSQL -- it has always been this
way.  However, the means by which an upgrade is performed is not readily 
performed in a fully automated fashion, as a "dump-initdb-restore" cycle has
to be performed. This doesn't appear to be too difficult -- however, dumping
the old database requires the old executables -- and, if you've already done
an rpm -U postgresql* (or upgraded from an older version of RedHat and didn't
specifically exclude the postgresql rpms), you no longer have the older 
executables to dump your data. And your data is useless (until you reinstall
the old version, that is). All RPM's prior to late releases of version 6.5.
1 have this upgrade issue.

The newest RPM's for PostgreSQL attempt to make your job in upgrading a little
easier.  First, during the installation of the new RPM's, a copy is made of
all the executable files and libraries necessary to make a backup of your data.
Second, the initialization script in the new postgresql-server package detects
the version of any database found -- if the version is old, then the startup
of the new version is aborted.  However, if no database is found, a new one 
is made.

One thing must be remembered -- due to the restructuring of the PostgreSQL
RPM's, you will have to manually select the postgresql-server package if you
want the server -- it is not installed by default in an upgrade. You can either
select it during the upgrade/install, or you can mount your RedHat CD and 
install manually with rpm -i.

To facilitate upgrading, the postgresql-dump utility has been provided.  Look
at the man page for postgresql-dump to see its usage.  All executables to
restore the immediately prior version of the PostgreSQL database are placed in
the directory /usr/lib/pgsql/backup, and are accessed by the postgresql-dump
script.  The directory /usr/lib/pgsql/backup is owned by the postgres user -- 
you can use this directory to hold dump files and preserve directories.

The basic sequence is:
(as user postgres):
postgresql-dump -t /var/lib/pgsql/backup/db.bak -p /var/lib/pgsql/backup/old -d
(you can abort the ASCII dump with 'Q', as it uses more) Then, (as user root):
/etc/rc.d/init.d/postgresql start
(which will automatically create a new database structure) And finally,
(as user postgres):
psql -e template1 </var/lib/pgsql/backup/db.bak

Once you are satisfied that the data has been restored properly, you may remove
the dump file (/var/lib/pgsql/backup/db.bak) and the preserve directory 
(/var/lib/pgsql/backup/old).

EXPLANATION OF STEPS:
-------------------------------------------------------------------------------
postgresql-dump: dumps the old database structure out, using the postmaster and 
the backend saved during the rpm upgrade. This step MUST be done as user 
postgres.

/etc/rc.d/init.d/postgresql start: initializes the new database structure that
the data from your old version will be restored into, does some sanity 
checking, and starts the postmaster.  Due to the nature of some of the tasks, 
this step must be done as root.

psql -e: restores the old database into the new structure created by the 
previous step.

NOTE:
-------------------------------------------------------------------------------
If you have added tables, indices, or basically anything to the template1 
database which is the default administrative database this script will NOT 
upgrade your database. As a matter of fact you will lose your data included 
in the template1 database. Please look at www.postgresql.org for information 
on upgrading the template1 database. This is a known bug in the PostgreSQL
pg_dump and pg_dumpall utilities.

REGRESSION TESTING
-------------------------------------------------------------------------------
One of the features of the newer RPM sets is the capability to perform the 
regression tests.  These tests stress your database installation and produce
results that give you assurances that the installation is complete, and that
your database machine is up to the task.

To run the regression tests under the RPM installation, make sure that
postmaster has been started (if not, su to root and execute the
'/etc/rc.d/init.d/postgresql start' init script), cd to
/usr/lib/pgsql/test/regress, su to postgres, and execute the command line:
time ./regress.sh linux | tee regress.out
This command line will start the regression tests and will both show the
results to the screen and store the results in the file regress.out.
It will also give you a crude benchmark of how fast your machine performs.

There are some tests that will almost always fail with RedHat Linux 5.x and 6.x
installations.  The geometry, float8, and on occassion the random test will 
fail.  These failures are normal for RedHat 5.2 and 6.1.  For RedHat 6.1 with
certain i18n settings, there will be other tests fail.

For interpretation of the regression tests, see the PostgreSQL documentation.

STARTING POSTMASTER AUTOMATICALLY AT SYSTEM STARTUP
-------------------------------------------------------------------------------
RedHat Linux uses the System V Init package.  A startup script for PostgreSQL
is provided in the server package, as /etc/rc.d/init.d/postgresql.  To start
the postmaster, with sanity checking, as root, run
/etc/rc.d/init.d/postgresql start
to shut postmaster down,
/etc/rc.d/init.d/postgresql stop
There are other parameters to this script -- /etc/rc.d/init.d/postgresql for a
listing.

To get this script to run at system startup or any time the system switches into
runlevels 4, 5, or 6, run 'chkconfig --add postgresql', and the proper symlinks 
will be created.  Check the chkconfig man page for more information.

MORE INFORMATION
-------------------------------------------------------------------------------
You can get more information at http://www.ramifordistat.net/postgres

Please help make this packaging better -- let me know if you find problems, or
better ways of doing things.  You can reach me by e-mail at
lamar.owen@wgcr.org.

-----------------------------------------------------------------------------