Page MenuHomePhabricator

missing explicit type casts. in DatabasePostgres.php
Closed, ResolvedPublic

Description

Author: Swen.Wacker

Description:
Using
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() [function.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


Version: unspecified
Severity: normal
OS: Linux
Platform: Other

Details

Reference
bz7764

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.
StatusSubtypeAssignedTask
InvalidNone
ResolvedNone

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:25 PM
bzimport set Reference to bz7764.
bzimport added a subscriber: Unknown Object (MLST).

Swen.Wacker wrote:

A database error has occurred ...

Attached:

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

          $transFields
FROM $page as cat
JOIN $categorylinks ON cl_from = cat.page_id

Swen.Wacker wrote:

Jepp! Thanks Greg, for this good and fast solution!

Jdforrester-WMF subscribed.

Migrating from the old tracking task to a tag for PostgreSQL-related tasks.