r77733 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77732‎ | r77733 | r77734 >
Date:18:38, 4 December 2010
Author:reedy
Status:ok
Tags:
Comment:
Fix table join order bug from change between MySQL 4 to 5.1, noticed by vvv in #wikimedia-dev

SELECT cr_id,cr_repo_id,cr_status,COUNT(DISTINCT cc_id) AS comments,cr_path,cr_message,cr_author,cr_timestamp FROM `code_rev`, `code_tags` LEFT JOIN `code_comment` ON ((cc_repo_id = cr_repo_id AND cc_rev_id = cr_id)) WHERE cr_repo_id = '3' AND (cr_repo_id=ct_repo_id) AND (cr_id=ct_rev_id) AND ct_tag = 'api' GROUP BY cr_id ORDER BY cr_id DESC LIMIT 51;


to

SELECT cr_id,cr_repo_id,cr_status,COUNT(DISTINCT cc_id) AS comments,cr_path,cr_message,cr_author,cr_timestamp FROM `code_tags`,`code_rev` LEFT JOIN `code_comment` ON ((cc_repo_id = cr_repo_id AND cc_rev_id = cr_id)) WHERE cr_repo_id = '3' AND (cr_repo_id=ct_repo_id) AND (cr_id=ct_rev_id) AND ct_tag = 'api' GROUP BY cr_id ORDER BY cr_id DESC LIMIT 51;
Modified paths:
  • /trunk/extensions/CodeReview/ui/CodeRevisionTagView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/ui/CodeRevisionTagView.php
@@ -19,7 +19,7 @@
2020
2121 function getQueryInfo() {
2222 $info = parent::getQueryInfo();
23 - $info['tables'][] = 'code_tags';
 23+ $info['tables'] = array_merge( array( 'code_tags' ), $info['tables'] );
2424 $info['conds'][] = 'cr_repo_id=ct_repo_id';
2525 $info['conds'][] = 'cr_id=ct_rev_id';
2626 $info['conds']['ct_tag'] = $this->mTag; // fixme: normalize input?

Follow-up revisions

RevisionCommit summaryAuthorDate
r77734Useful comment to go with r77733reedy18:43, 4 December 2010
r77736MFT r77733-77734demon19:01, 4 December 2010
r77739Per Nikerabbit, use array_unshift, as it's more readable than the array_merge...reedy19:45, 4 December 2010

Status & tagging log