[Slackbuilds-users] PostgreSQL - multiple installed versions

Thomas Morper thomas at beingboiled.info
Tue Sep 17 22:24:25 UTC 2013


On Wed, 11 Sep 2013, Adis Nezirovic wrote:

> 3) You have PostgreSQL installed (let's say 9.x series, or at least 8.3) 
> You want to do in-place testing (two running PostgreSQL instances) and 
> upgrade using pg_upgrade

I've got a small 15 GB Postgres 9.2 DB on a modest Atom server. The 
traditional dump/restore cycle takes around 3 hours, so the new approach 
to an easier "pg_upgrade" is very much welcome.

> 3.3) Install new PostgreSQL 9.3, while keeping the old package installed 
> as well. Please note that new PostgreSQL will have binaries in 
> /usr/lib64/postgresql/9.3/bin, and install script create symlinks in 
> /usr/bin only if respective postgresql binaries are not found in 
> /usr/bin (i.e. it will _not_ overwrite your PostgreSQL 9.x binaries!)

Minor problem: doinst.sh generates broken symlinks to usr/lib... instead 
of /usr/lib... - was easily fixed.

> 3.4) Make sure new rc.postgresql script is active

Minor problem: "Could not find 'postgres' binary." because the PRGNAM 
variable is missing in rc.postgresql. Again, easily fixed. Hmm... does 
this actually need to be a variable?

> Any feedback on all of this and testing the SlackBuild would be warmly 
> welcomed.

Besides those two minor issues (see attached diff for my changes) your 
test release of the SlackBuild has been working fine for me. Adding the 
"--link" option to pg_upgrade allowed upgrading from 9.2 to 9.3 in about a 
minute with no need for a dump/restore-cycle.

-- 
-------------- next part --------------
diff -u -r postgresql-an/doinst.sh postgresql-tm/doinst.sh
--- postgresql-an/doinst.sh	2013-09-11 14:39:41.000000000 +0200
+++ postgresql-tm/doinst.sh	2013-09-17 20:44:40.822303331 +0200
@@ -30,10 +30,10 @@
   if [ -e usr/bin/$pg_prog ]; then
     # make sure we overwrite only symlinks and not actual binaries
     if [ -L usr/bin/$pg_prog ]; then
-      ln -sf $pg_binary usr/bin/$pg_prog
+      ln -sf /$pg_binary usr/bin/$pg_prog
     fi
   else
-    ln -s $pg_binary usr/bin/$pg_prog
+    ln -s /$pg_binary usr/bin/$pg_prog
   fi
 done
 
diff -u -r postgresql-an/rc.postgresql.new postgresql-tm/rc.postgresql.new
--- postgresql-an/rc.postgresql.new	2013-09-11 14:39:41.000000000 +0200
+++ postgresql-tm/rc.postgresql.new	2013-09-17 22:14:27.446243178 +0200
@@ -23,6 +23,7 @@
 
 PG_VERSION=${PG_VERSION:- at PG_VERSION@}
 PG_PORT=${PG_PORT:- at PG_PORT@}
+PRGNAM=${PRGNAM:- at PRGNAM@}
 LIBDIRSUFFIX="@LIBDIRSUFFIX@"
 
 if [ "x$PG_VERSION" != "x9.2" ];then


More information about the SlackBuilds-users mailing list