Last modified: 2010-05-15 15:38:55 UTC
I'm using # MediaWiki: 1.5beta4 # PHP: 4.3.10 (apache2handler) # MySQL: 3.23.58 when run Special:Random, it shows: SELECT page_id,page_title FROM `page` FORCE INDEX (page_random) WHERE page_namespace=0 AND page_is_redirect=0 AND page_random>0.083694135933 ORDER BY page_random LIMIT 1 from function "wfSpecialRandompage"。 MySQL returns error "1064: You have an error in your SQL syntax near 'INDEX (page_random) WHERE page_namespace=0 AND page_is_redirect=0 AND page_' at line 2 (localhost)"。 when run Special:Contributions SELECT page_namespace,page_title,page_is_new,page_latest, rev_id,rev_timestamp,rev_comment,rev_minor_edit,rev_user_text, rev_deleted FROM `page`,`revision` FORCE INDEX (usertext_timestamp) WHERE page_id=rev_page AND rev_user_text='老猪' ORDER BY rev_timestamp DESC LIMIT 50 from function "contribs_finder::find"。 MySQL returns error "1064: You have an error in your SQL syntax near 'INDEX (usertext_timestamp) WHERE page_id=rev_page AND rev_user_text='老猪'' at line 5 (localhost)"。 when run Special:Watchlist: SELECT page_namespace,page_title,rev_comment, page_id, rev_user,rev_user_text,rev_timestamp,rev_minor_edit,rev_id,page_is_new,wl_notificationtimestamp FROM `watchlist`,`page`,`revision` FORCE INDEX (page_timestamp) WHERE wl_user=2 AND wl_namespace=page_namespace AND wl_title=page_title AND page_latest=rev_id AND rev_timestamp > '20050803005507' ORDER BY rev_timestamp DESC from function "wfSpecialWatchlist"。 MySQL returns error "1064: You have an error in your SQL syntax near 'INDEX (page_timestamp) WHERE wl_user=2 AND wl_namespace=page_namespace ' at line 4 (localhost)"。
I think this comes from the the file includes/Database.php the function useIndexClause was changed from function useIndexClause( $index ) { return "USE INDEX ($index)"; } to function useIndexClause( $index ) { return "FORCE INDEX ($index)"; } I am running PHP 4.3.11 with Mysql 3.23.58 Reverting to the old form fixes my problem.
problem solved! thanks a lot!!!
From http://dev.mysql.com/doc/mysql/en/join.html 'From MySQL 4.0.9 on, you can also use FORCE INDEX' Might not be available in mysql3 :(
Now using FORCE INDEX only when MySQL 4 extensions are enabled. Fix committed to HEAD and REL1_5: * (bug 3056) MySQL 3 compatibility fix: USE INDEX instead of FORCE INDEX * PHP 4.1 compatibility fix: don't use new_link parameter to mysql_connect if running prior to 4.2.0 as it causes the call to fail r1=1.119&r2=1.120">http://cvs.defau.lt/cvsweb.cgi/phase3/includes/Database.php.diff?r1=1.119&r2=1.120