Subject: Moving database directories

From: [email-masked] (John Campbell)
Date: Thu, 17 Dec 92 12:31:48 -0800

In the Postgres User Manual, the following section is presented
(section 9.2 in my manual):
   
   Moving database directories out of $POSTGRESHOME/data/base
   
   By default, all databases are stored in separate  subdirec-
   tories under $POSTGRESHOME/data/base(1).  To move a particular 
   data base to an  alternate directory (e.g., on a filesystem with 
   more free space), do the following:
   
   +    Create the database (if it doesn't already exist) using
        the  createdb  command.  In the following steps we will
        assume the database is named foo.
   
   +    Copy the directory $POSTGRESHOME/data/base/foo and its
        contents to its ultimate destination. It should still 
        be owned by the postgres user.
   
   +    Remove the directory $POSTGRESHOME/data/base/foo.
   
   +    Make a symbolic link in $POSTGRESHOME/data/base to the 
        new directory.
   
   ____________________
   
      [1]Data for certain classes may  stored  elsewhere  if  a
   non-standard storage manager was specified when they were
   created.
   
I have tried this and do not believe it works.   Postgres wants
to open files in the parent (..) directory, but (..) won't work after 
you've followed a sym-link.

Here's what I have in my parent directory:

   PG_VERSION	pg_database	pg_log		pg_time
   base		pg_defaults	pg_magic	pg_user
   pg.debug	pg_demon	pg_server	pg_variable
   
The error message that I get, from the postgres back end, is
that it can't open pg_log.  From the front end I get the message
that the version isn't right (and a query asking if I've run
createdb).

The best I believe you can do is 1) make a sym-link for all of
~postgres/data to some other partition (which works nicely--that's
what I'm doing) or 2) make a sym-link as described above and copy
the .. files to the parent of the new sym-link.  The second method,
however, causes at least pg_user problems.

A possible solution might be to have both POSTGRESHOME and POSTGRESDATA
environment variables and not use .. if POSTGRESDATA is defined.  This
would, I believe, allow the manual instructions above to work.

-- 
	John Campbell               [email-masked]
        [email-masked]      [email-masked]

---

From: <[email-masked]>
Date: Thu, 17 Dec 92 12:40:26 PST

In message <[email-masked]> you write:

>    ...

you're right; relative pathname addressing has been removed from the
current development version of the system, and will be out in the
next release.

> would, I believe, allow the manual instructions above to work.

again, you're right; this is what we've done in the development version.

					mike