From 56d83f92d652dd87c84a9b722ad13c06dd3c7a5d Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 8 Oct 2021 06:30:13 +0000 Subject: [PATCH] Bug 29138: (QA follow-up) Changes to UPDATE Content-Type: text/plain; charset=utf-8 Move the condition to the WHERE clause. Signed-off-by: Marcel de Rooy Tested on NULL, 0, 1, 2, no, yes. (2 and yes become 0 too. Fine.) Replaced IFNULL by COALESCE. --- installer/data/mysql/atomicupdate/Bug_29138.pl | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/installer/data/mysql/atomicupdate/Bug_29138.pl b/installer/data/mysql/atomicupdate/Bug_29138.pl index 731099f8ac..55181d2788 100755 --- a/installer/data/mysql/atomicupdate/Bug_29138.pl +++ b/installer/data/mysql/atomicupdate/Bug_29138.pl @@ -6,12 +6,9 @@ return { up => sub { my ($args) = @_; my ($dbh, $out) = @$args{qw(dbh out)}; - # Do you stuffs here $dbh->do(q{ - UPDATE systempreferences SET value= IF(value='no',0,1) - WHERE variable = 'LoadSearchHistoryToTheFirstLoggedUser'; - }); - # Print useful stuff here - say $out "LoadSearchHistoryToTheFirstLoggedUser updated"; + UPDATE systempreferences SET value=0 + WHERE variable='LoadSearchHistoryToTheFirstLoggedUser' AND IFNULL(value,0)<>1; + }); }, } -- 2.20.1