Changeset:
        372d2538aa69
        
https://sourceforge.net/p/mrbs/hg-code/ci/372d2538aa69a47b059b5bb1f8f6f834fc948afb
Author:
        Campbell Morrison <cimorri...@hg.code.sf.net>
Date:
        Sat Jun 03 06:01:25 2017 +0100
Log message:

Merge

diffstat:

 web/upgrade/52/post.inc |  28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diffs (38 lines):

diff -r 836f12a17665 -r 372d2538aa69 web/upgrade/52/post.inc
--- a/web/upgrade/52/post.inc   Sat Jun 03 05:58:49 2017 +0100
+++ b/web/upgrade/52/post.inc   Sat Jun 03 06:01:25 2017 +0100
@@ -9,6 +9,34 @@
 // is split by semi-colons.
 if ($dbsys == "pgsql")
 {
+  // Ensure plpgsql language is installed
+  $sql = <<<END_OF_SQL
+CREATE OR REPLACE FUNCTION create_language_plpgsql()
+RETURNS BOOLEAN AS \$\$
+    CREATE LANGUAGE plpgsql;
+    SELECT TRUE;
+\$\$ LANGUAGE SQL;
+
+SELECT CASE WHEN NOT
+    (
+        SELECT  TRUE AS exists
+        FROM    pg_language
+        WHERE   lanname = 'plpgsql'
+        UNION
+        SELECT  FALSE AS exists
+        ORDER BY exists DESC
+        LIMIT 1
+    )
+THEN
+    create_language_plpgsql()
+ELSE
+    FALSE
+END AS plpgsql_created;
+
+DROP FUNCTION create_language_plpgsql();
+END_OF_SQL;
+  $admin_handle->command($sql);
+
   // Add function to update timestamp column
   $sql = <<<END_OF_SQL
 CREATE OR REPLACE FUNCTION update_timestamp_column()   

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mrbs-commits mailing list
Mrbs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to