Postgresql – Update Postgres on server that already has version included with system

mac os xpostgresql

Mac OS X (Lion) Server includes Postgres (9.0.5) that it uses for some system utilities (Wiki server, caldav, etc.). I'm about to start using this server for some Rails applications and am wondering how to get my "kit" set up correctly. I'd like the version of Postgres to be the same (9.1.3) from development into production…though I suppose this isn't absolutely mandatory.

Being as Apple probably won't update the system version of Postgres past 9.0.x until Mountain Lion this summer what's the best way to get 9.1.3 on the server? I've been warned against replacing the system version as it might screw up some of Apple's tools or, perhaps, just get overwritten when there's a Lion update.

Is it true that Postgres can happily run multiple versions of itself on the same server…under same OS instance? If so then I assume I could just install 9.1.3 into /usr/local/ and create new clusters there…leaving the system install alone? But I'm concerned about conflicts. Dunno. never tried this?!?

Maybe there's a another way to handle this?

Best Answer

Is it true that Postgres can happily run multiple versions of itself on the same server...under same OS instance?

I've run 8.3, 8.4, 9.0, and 9.1 at the same time on a single Windows server. You just need each PostgreSQL server listening on a different port. Choosing the port is part of the installation process.

I'm far to cynical to believe that PostgreSQL will never overwrite an existing data directory, but in my experience (none of it on OS/X), each version installs its own data directory.