Page MenuHomePhabricator

API error when using rvprop=tags
Closed, ResolvedPublic

Description

The api url returns:

#0 /usr/local/apache/common-local/wmf-deployment/includes/db/Database.php(541): DatabaseBase->reportQueryError('Unknown column ...', 1054, 'SELECT rev_id,...', 'ApiQueryRevisio...', false)
#1 /usr/local/apache/common-local/wmf-deployment/includes/db/Database.php(877): DatabaseBase->query('SELECT rev_id,...', 'ApiQueryRevisio...')
#2 /usr/local/apache/common-local/wmf-deployment/includes/api/ApiQueryBase.php(233): DatabaseBase->select(Array, Array, Array, 'ApiQueryRevisio...', Array, Array)
#3 /usr/local/apache/common-local/wmf-deployment/includes/api/ApiQueryRevisions.php(307): ApiQueryBase->select('ApiQueryRevisio...')
#4 /usr/local/apache/common-local/wmf-deployment/includes/api/ApiQuery.php(224): ApiQueryRevisions->execute()
#5 /usr/local/apache/common-local/wmf-deployment/includes/api/ApiMain.php(478): ApiQuery->execute()
#6 /usr/local/apache/common-local/wmf-deployment/includes/api/ApiMain.php(267): ApiMain->executeAction()
#7 /usr/local/apache/common-local/wmf-deployment/includes/api/ApiMain.php(251): ApiMain->executeActionWithErrorHandling()
#8 /usr/local/apache/common-local/wmf-deployment/api.php(116): ApiMain->execute()
#9 /usr/local/apache/common-local/live-1.5/api.php(3): require('/usr/local/apac...')
#10 {main}

Pinpointed to the tags rvprop. "<RoanKattouw> It's probably forgetting to join something then"


Version: 1.17.x
Severity: normal
URL: http://en.wikipedia.org/w/api.php?action=query&prop=revisions&title=User:Tisane/Test1&rvprop=ids|flags|timestamp|user|size|comment|content|tags|flagged&revids=370622948

Details

Reference
bz24166

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:06 PM
bzimport set Reference to bz24166.

"<RoanKattouw> It's the MySQL 5 regression where SELECT * FROM foo, bar LEFT JOIN baz ON baz_id=foo_id breaks"

http://192.168.0.190/w/api.php?action=query&prop=revisions&title=User:Tisane/Test1&rvprop=ids|flags|timestamp|user|size|comment|content|tags&revids=33

Query 6 (slave): SELECT /* ApiQueryRevisions::execute 192.168.0.133 */ rev_id,rev_page,rev_text_id,rev_timestamp,rev_comment,rev_user_text,rev_user,rev_minor_edit,rev_deleted,rev_len,rev_parent_id,page_namespace,page_title,page_latest,ts_tags,old_id,old_text,old_flags FROM mw_page,mw_revision,mw_text LEFT JOIN mw_tag_summary ON ((rev_id=ts_rev_id)) WHERE (page_id = rev_page) AND (rev_text_id=old_id) AND rev_id = '33' ORDER BY rev_id LIMIT 2
SQL ERROR: Unknown column 'rev_id' in 'on clause' (localhost)

SELECT rev_id,rev_page,rev_text_id,rev_timestamp,rev_comment,rev_user_text,rev_user,rev_minor_edit,rev_deleted,rev_len,rev_parent_id,page_namespace,page_title,page_latest,ts_tags,old_id,old_text,old_flags FROM mw_page,mw_revision JOIN mw_text LEFT JOIN mw_tag_summary ON ((rev_id=ts_rev_id)) WHERE (page_id = rev_page) AND (rev_text_id=old_id) AND rev_id = '33' ORDER BY rev_id LIMIT 2;

Fixes it

Per http://www.delphifaq.com/faq/databases/mysql/f1110.shtml

a join before the last table before the left join :/

Mmmm, Hax?