Page MenuHomePhabricator

SQL query error in CategoryTree::renderParents
Closed, ResolvedPublic

Description

https://en.wikipedia.org/w/index.php?title=Special%3ACategoryTree&target=Meteorites&mode=all&namespaces= gives the error:

Technical details about this error:
Last attempted database query: (SQL query hidden)
Function: CategoryTree::renderParents
MySQL error: 1054: Unknown column 'page_namespace' in 'field list' (10.0.6.69)


Version: master
Severity: major

Details

Reference
bz43253

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 12:55 AM
bzimport set Reference to bz43253.
bzimport added a subscriber: Unknown Object (MLST).
		$res = $dbr->select(
			'categorylinks',
			array(
				NS_CATEGORY => 'page_namespace',
				'cl_to' => 'page_title'
			),
			array( 'cl_from' => $title->getArticleID() ),
			__METHOD__,
			array(
				'LIMIT' => $wgCategoryTreeMaxChildren,
				'ORDER BY' => 'cl_to'
			)
		);

A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:
SELECT page_namespace,page_title AS cl_to FROM mw_categorylinks WHERE cl_from = '2' ORDER BY cl_to LIMIT 200
from within function ‘CategoryTree::renderParents.’ Database returned error ‘1054: Unknown column 'page_namespace' in 'field list' (192.168.0.212).’

reedy@fenari:~$ mwscript eval.php enwiki

$dbr = wfGetDB( DB_SLAVE );

$res = $dbr->select( 'categorylinks', array( NS_CATEGORY => 'page_namespace', 'cl_to' => 'page_title' ), array( 'cl_from' => 1 ), METHOD, array( 'LIMIT' => 10, 'ORDER BY' => 'cl_to' ) );

A database error has occurred. Did you forget to run maintenance/update.php after upgrading? See: https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script
Query: SELECT page_namespace,page_title AS cl_to FROM categorylinks WHERE cl_from = '1' ORDER BY cl_to LIMIT 10
Function:
Error: 1054 Unknown column 'page_namespace' in 'field list' (10.0.6.46)

reedy@fenari:~$ mwscript eval.php enwiki

$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'categorylinks', array( 'page_namespace' => NS_CATEGORY, 'page_title' => 'cl_to' ), array( 'cl_from' => 1 ), METHOD, array( 'LIMIT' => 10, 'ORDER BY' => 'cl_to' ) );

$sql = $dbr->selectSQLText( 'categorylinks', array( 'page_namespace' => NS_CATEGORY, 'page_title' => 'cl_to' ), array( 'cl_from' => 1 ), METHOD, array( 'LIMIT' => 10, 'ORDER BY' => 'cl_to' ) );

var_dump( $sql );

string(118) "SELECT 14 AS page_namespace,cl_to AS page_title FROM categorylinks WHERE cl_from = '1' ORDER BY cl_to LIMIT 10 "

https://gerrit.wikimedia.org/r/39384