[Mapbender-commits] r2401 - branches/2.5/resources/db/postgresql

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Apr 21 10:46:47 EDT 2008


Author: christoph
Date: 2008-04-21 10:46:46 -0400 (Mon, 21 Apr 2008)
New Revision: 2401

Modified:
   branches/2.5/resources/db/postgresql/pgsql_schema.sql
Log:
create plpgsql only if it is not existent

Modified: branches/2.5/resources/db/postgresql/pgsql_schema.sql
===================================================================
--- branches/2.5/resources/db/postgresql/pgsql_schema.sql	2008-04-21 13:15:21 UTC (rev 2400)
+++ branches/2.5/resources/db/postgresql/pgsql_schema.sql	2008-04-21 14:46:46 UTC (rev 2401)
@@ -2,6 +2,28 @@
 -- PostgreSQL database dump Mapbender 2.5
 --
 
+-- check if plpgsql exists; if yes, install it.
+CREATE OR REPLACE FUNCTION public.create_plpgsql_language ()
+        RETURNS TEXT
+        AS $$
+            CREATE LANGUAGE plpgsql;
+            SELECT 'language plpgsql created'::TEXT;
+        $$
+LANGUAGE 'sql';
+
+SELECT CASE WHEN
+              (SELECT true::BOOLEAN
+                 FROM pg_language
+                WHERE lanname='plpgsql')
+            THEN
+              (SELECT 'language already installed'::TEXT)
+            ELSE
+              (SELECT public.create_plpgsql_language())
+            END;
+
+DROP FUNCTION public.create_plpgsql_language ();
+
+-- function gettext for i18n (requires plpgsql)
 CREATE FUNCTION gettext(locale_arg text, string text) RETURNS character varying
     AS $$
  DECLARE



More information about the Mapbender_commits mailing list