When I initially built my primary server, the latest stable postgresql package was 8.0.x. At this time that same tree is still marked as stable. I'm sure that this is largely due to the overall postgresql upgrade philosophy, which involves dumping (backing up) all your dbs and the restoring them after the upgrade. Since that isn't a seamless process, I'm sure they want an upgrade to be a conscious decision. That being said, the current upgrade path involves switching from the dev-db/postgresql package to the dev-db/postgresql-base/dev-db/postgresql-server packages.

Many thanks to @dberkholz for pointing me at the package maintainer's blog (which doesn't come up when searching google due to the large number of portage search/info listings). Here's what I ended up doing:

  • pg_dumpall > /tmp/please_work.dump
  • /etc/init.d/postgresql stop && emerge unmerge libpq postgres
  • echo "dev-db/postgresql-base ~amd64" >> /etc/portage/package.keywords
    echo "dev-db/postgresql-server ~amd64" >> /etc/portage/package.keywords
    echo "virtual/postgresql-server ~amd64" >> /etc/portage/package.keywords
    echo "virtual/postgresql-base ~amd64" >> /etc/portage/package.keywords
  • emerge -uD postgresql-base postgresql-server
  • emerge --config "=dev-db/postgresql-server-8.3.3"
  • rc-update add postgresql-8.3 default
Now here's where you get to rebuild everything that links to libpq and update postgresql.conf as needed. Once that's done you use pg_restore to reload all your data. I had some grants fail, so I needed to redo them manually. So far so good, the db seems to be a bit faster and less resource hungry. I may post the rrd graphs from cacti later, but there is a noticeable difference.



2 Responses to “upgrading to postgresql 8.3 on gentoo”

  1. Anny Anny Says:
    PS How can I get that little cloud before the comment link on the blog? Is that Haloscan and Blog template?
  2. Mike Mike Says:
    This worked reasonably well for me with the following additions... 1. had to edit /etc/passwd to change postgres user's shell to /bin/bash to make emerge postgresql-server --config work. 2. Had to upgrade sys-apps/shadow to make the init script work. (There was some change to su command: the old one wouldn't accept the su -l that was used for starting the server.) 3. Had to remove postgres from default runlevel as well as add postgres-8.3 4. revdev-rebuild was required afterwards to recompile things that depended on libpq from old postgres version. For example: my email accounts are stored in a postgresql database so courier-authlib was one package effected.

Leave a Reply