Page MenuHomePhabricator

Special:ListFiles get sql error with new comment table on misermode = false
Closed, ResolvedPublic

Description

When setting $wgMiserMode = false and $wgCommentTableSchemaMigrationStage = MIGRATION_WRITE_NEW the builded sql is invalid on Special:ListFiles:

Query: SELECT img_timestamp,img_name,img_name AS thumb,img_size,img_user_text,COUNT(oi_archive_name) AS count,img_user AS img_user,COALESCE( comment_img_description.comment_text, img_description ) AS `img_description_text`,comment_img_description.comment_data AS `img_description_data`,comment_img_description.comment_id AS `img_description_cid`,'img_description' AS `description_field` FROM `image`,`image_comment_temp` `temp_img_description`,`comment` `comment_img_description` LEFT JOIN `oldimage` ON ((oi_name = img_name)) GROUP BY img_user,img_timestamp,img_name,img_size,img_user_text,img_description ORDER BY img_timestamp DESC LIMIT 52 
 Function: IndexPager::buildQueryInfo (ImageListPager)
 Error: 1054 Unknown column 'img_name' in 'on clause' (localhost)

The additional join to the oldimage table for counting makes problems here

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 6 2017, 8:54 PM
Anomie claimed this task.Dec 7 2017, 3:15 PM

It's not the added join so much as the fact that the code adding the join is stomping on the join_conds for all the other joins involved.

Change 396019 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/core@master] ImageListPager: Don't stomp on $join_conds

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

Change 396019 merged by jenkins-bot:
[mediawiki/core@master] ImageListPager: Don't stomp on $join_conds

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

Change 396035 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/core@REL1_30] ImageListPager: Don't stomp on $join_conds

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

Change 396035 merged by Umherirrender:
[mediawiki/core@REL1_30] ImageListPager: Don't stomp on $join_conds

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

Umherirrender closed this task as Resolved.Dec 7 2017, 4:50 PM

Looks good and works:

SELECT img_timestamp,img_name,img_name AS thumb,img_size,img_user_text,COUNT(oi_archive_name) AS count,img_user AS img_user,COALESCE( comment_img_description.comment_text, img_description ) AS `img_description_text`,comment_img_description.comment_data AS `img_description_data`,comment_img_description.comment_id AS `img_description_cid`,'img_description' AS `description_field` FROM `image` LEFT JOIN `image_comment_temp` `temp_img_description` ON ((temp_img_description.imgcomment_name = img_name)) LEFT JOIN `comment` `comment_img_description` ON ((comment_img_description.comment_id = temp_img_description.imgcomment_description_id)) LEFT JOIN `oldimage` ON ((oi_name = img_name)) GROUP BY img_user,img_timestamp,img_name,img_size,img_user_text,img_description ORDER BY img_timestamp DESC LIMIT 52