Last modified: 2006-10-31 13:20:55 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 7764 - missing explicit type casts. in DatabasePostgres.php
missing explicit type casts. in DatabasePostgres.php
Product: MediaWiki extensions
Classification: Unclassified
CategoryTree (Other open bugs)
Other Linux
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
Blocks: postgres
  Show dependency treegraph
Reported: 2006-10-30 21:13 UTC by Swen Wacker
Modified: 2006-10-31 13:20 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---

A database error has occurred ... (2.21 KB, text/html)
2006-10-30 21:18 UTC, Swen Wacker

Description Swen Wacker 2006-10-30 21:13:14 UTC
MediaWiki: 1.8.2
PHP: 5.1.4-pl0-gentoo (apache)
PostgreSQL: PostgreSQL 8.1.4 on x86_64-pc-linux-gnu, compiled by GCC
x86_64-pc-linux-gnu-gcc (GCC) 3.4.5 (Gentoo 3.4.5, ssp-3.4.5-1.0, pie-8.7.9)

Used Extensions:
    * Special pages:
          o CategoryTree 
    * Parser hooks:
          o CategoryTree 
          o CharInsert
          o Inputbox
          o ParserFunctions

Opening Spezial:CategoryTree und looking for an (existing) Category says: 
Warning: pg_query() []: Query failed: ERROR: function
if(boolean, integer, integer) does not exist HINT: No function matches the given
name and argument types. You may need to add explicit type casts. in
/var/(...)/mediawiki-1.8.2/includes/DatabasePostgres.php on line 381

Backtrace (using $wgShowExceptionDetails = true;) see attachment
Comment 1 Swen Wacker 2006-10-30 21:18:17 UTC
Created attachment 2603 [details]
A database error has occurred ...
Comment 2 Greg Sabino Mullane 2006-10-30 21:30:55 UTC
Looks like that extensions has some MySQLisms. Try this patch out to fix the
immediate problem:

Index: CategoryTreeFunctions.php
--- CategoryTreeFunctions.php   (revision 17312)
+++ CategoryTreeFunctions.php   (working copy)
@@ -180,7 +180,7 @@
                $categorylinks = $dbr->tableName( 'categorylinks' );

                $sql = "SELECT cat.page_namespace, cat.page_title,
-                                         if( cat.page_namespace = " .
NS_CATEGORY . ", 0, 1) as presort
+                               CASE WHEN cat.page_namespace=".NS_CATEGORY."
THEN 0 ELSE 1 END AS presort
                                FROM $page as cat
                                JOIN $categorylinks ON cl_from = cat.page_id
Comment 3 Swen Wacker 2006-10-30 21:47:03 UTC
Jepp! Thanks Greg, for this good and fast solution!
Comment 4 Greg Sabino Mullane 2006-10-31 13:20:55 UTC
Fixed in r17320.

Note You need to log in before you can comment on or make changes to this bug.