Changeset:
37d6d1f56691
https://sourceforge.net/p/mrbs/hg-code/ci/37d6d1f56691bea326f2d492aae7c1017be75afc
Author:
John Beranek <[email protected]>
Date:
Fri Jun 02 11:25:47 2017 +0100
Log message:
Upgrade 52 improved to install plpgsql language, if required, before
creating a plpgsql function.
diffstat:
web/upgrade/52/post.inc | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diffs (38 lines):
diff -r 666f5a0c7bd3 -r 37d6d1f56691 web/upgrade/52/post.inc
--- a/web/upgrade/52/post.inc Thu Jun 01 23:09:28 2017 +0100
+++ b/web/upgrade/52/post.inc Fri Jun 02 11:25:47 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits