From b53f0c278f6cb84c3cbbcb3100231c8c7e2fd870 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Thu, 18 Oct 2018 16:51:42 -0400 Subject: [PATCH] Add COALESCE for image deletion and imgcomment_description_id I have no idea why this suddenly started raising an error rather than it doing so since February (I0dd7258fe). But this should fix it. Bug: T207419 Change-Id: Id97e1c7c2655d90928c777bc3377e5ea23f49f6b --- includes/filerepo/file/LocalFile.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index 254ceff1b0..d22c9a61ed 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -1543,8 +1543,8 @@ class LocalFile extends File { } if ( $wgCommentTableSchemaMigrationStage >= MIGRATION_WRITE_BOTH ) { $tables[] = 'image_comment_temp'; - $fields['oi_description_id'] = - 'CASE WHEN img_description_id = 0 THEN imgcomment_description_id ELSE img_description_id END'; + $fields['oi_description_id'] = 'CASE WHEN img_description_id = 0 ' + . 'THEN COALESCE(imgcomment_description_id, 0) ELSE img_description_id END'; $joins['image_comment_temp'] = [ $wgCommentTableSchemaMigrationStage === MIGRATION_NEW ? 'JOIN' : 'LEFT JOIN', [ 'imgcomment_name = img_name' ] @@ -2539,8 +2539,8 @@ class LocalFileDeleteBatch { } if ( $wgCommentTableSchemaMigrationStage >= MIGRATION_WRITE_BOTH ) { $tables[] = 'image_comment_temp'; - $fields['fa_description_id'] = - 'CASE WHEN img_description_id = 0 THEN imgcomment_description_id ELSE img_description_id END'; + $fields['fa_description_id'] = 'CASE WHEN img_description_id = 0 ' + . 'THEN COALESCE(imgcomment_description_id, 0) ELSE img_description_id END'; $joins['image_comment_temp'] = [ $wgCommentTableSchemaMigrationStage === MIGRATION_NEW ? 'JOIN' : 'LEFT JOIN', [ 'imgcomment_name = img_name' ] -- 2.20.1