The man page for initdb says that the -t option will overwrite the template1
database with the up-to-date structure and suggests that this is the way to
upgrade to a newer release:

       --template

       -t     Replace  the  template1  database  in  an  existing
              database system, and  don't  touch  anything  else.
              This  is  useful when you need to upgrade your temï¿½
              plate1 database using initdb from a  newer  release
              of  PostgreSQL, or when your template1 database has
              become corrupted by some system  problem.  Normally
              the  contents of template1 remain constant throughï¿½
              out the life of  the  database  system.  You  can't
              destroy  anything by running initdb with the --temï¿½
              plate option.

How does this relate to pg_upgrade?  Is it necessary to do a pg_dump? If
not, is there a danger of new oids in template1 overwriting old oids in
user data?  (I am not clear whether oids are unique to a database or
to the whole PostgreSQL installation.)


-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
               PGP key from public servers; key ID 32B8FAA1
                 ========================================
     "If the Son therefore shall make you free, ye shall be 
      free indeed."         John 8:36  



Sun, 02 Apr 2000 07:07:46 +0100
"Oliver Elphick" <olly@lfix.co.uk>
Question about initdb -t
Oliver Elphick writes:

> The man page for initdb says that the -t option will overwrite the template1
> database with the up-to-date structure and suggests that this is the way to
> upgrade to a newer release

I believe it's wrong. The only thing -t does is fill up your template1
database with good data, say if you acidentally deleted all records from a
system table. It is not very useful generally, I think.

> How does this relate to pg_upgrade?

It doesn't. I have never used pg_upgrade but from looking at it I believe
what it does is create a new database schema (using pg_dumpall
information) and then instead of using COPY to get your data back in it
merely moves over the old on disk files for each table. The only thing
this buys you is time, it doesn't work around the various pg_dump
deficiencies or having to shut down the database, etc.

> Is it necessary to do a pg_dump?

Not unless you have something interesting in template1 you'd like to
preserve.

> If not, is there a danger of new oids in template1 overwriting old
> oids in user data?

No.

> (I am not clear whether oids are unique to a database or to the whole
> PostgreSQL installation.)

installation

-- 
Peter Eisentraut                  Sernanders vï¿½g 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden


Sun, 2 Apr 2000 23:18:39 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Re: Question about initdb -t