Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3255
pg_pltemplatecheck.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 9:25 PM
2014-11-21 21:25:23 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
pg_pltemplatecheck.patch
View Options
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 "<b>FAILED</b>. Make sure the language plpgsql is installed for the database <tt>$wgDBname</tt></li>";
- dieout("</ul>");
+ // 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 "<b>FAILED</b>. You need to install the language plpgsql in the database <tt>$wgDBname</tt></li>";
+ dieout("</ul>");
+ }
+ } else {
+ print "<b>FAILED</b>. You need to install the language plpgsql in the database <tt>$wgDBname</tt></li>";
+ dieout("</ul>");
+ }
+
}
print "OK</li>\n";
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2824
Default Alt Text
pg_pltemplatecheck.patch (1 KB)
Attached To
Mode
T9065: Create plpgsql automatically when we can ( >= PostgreSQL 8.1)
Attached
Detach File
Event Timeline
Log In to Comment