Index: openacs-4/packages/acs-kernel/sql/postgresql/postgresql.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/postgresql.sql,v
diff -u -r1.48.2.2 -r1.48.2.3
--- openacs-4/packages/acs-kernel/sql/postgresql/postgresql.sql	29 Apr 2016 07:56:56 -0000	1.48.2.2
+++ openacs-4/packages/acs-kernel/sql/postgresql/postgresql.sql	26 May 2016 19:27:04 -0000	1.48.2.3
@@ -997,9 +997,12 @@
     ret_val = 0;
 
     user_pg_version := string_to_array(trim(p__version),'.')::int[];
-    select string_to_array(setting, '.')::int[] into pg_version from pg_settings where name = 'server_version';
+    
+    --   select string_to_array(setting, '.')::int[] into pg_version from pg_settings where name = 'server_version';
+    -- the following version does not barf on beta-versions etc.
+    select string_to_array(setting::int/10000 || '.' || (setting::int%10000)/100 || '.' || (setting::int%100), '.')::int[] into pg_version
+    from pg_settings where name = 'server_version_num';
 
-
     for index in array_length(user_pg_version, 1) + 1..array_length(pg_version, 1) loop
         user_pg_version[index] := 0;
     end loop;
