Index: includes/DatabasePostgres.php =================================================================== --- includes/DatabasePostgres.php (revision 16128) +++ includes/DatabasePostgres.php (working copy) @@ -246,8 +246,21 @@ $SQL = "SELECT 1 FROM pg_catalog.pg_language WHERE lanname = 'plpgsql'"; $rows = $this->numRows($this->doQuery($SQL)); if ($rows < 1) { - print "FAILED. Make sure the language plpgsql is installed for the database $wgDBname"; - dieout(""); + // plpgsql is not installed, but if we have a pg_pltemplate table, we should be able to create it + print "not installed. Attempting to install Pl/Pgsql ..."; + $SQL = "SELECT 1 FROM pg_class c JOIN pg_namespace n ON (n.oid = c.relnamespace) WHERE relname = 'pg_pltemplate' AND nspname='pg_catalog'"; + $rows = $this->numRows($this->doQuery($SQL)); + if ($rows = 1) { + $result = $this->doQuery("CREATE LANGUAGE plpgsql"); + if (!$result) { + print "FAILED. You need to install the language plpgsql in the database $wgDBname"; + dieout(""); + } + } else { + print "FAILED. You need to install the language plpgsql in the database $wgDBname"; + dieout(""); + } + } print "OK\n";