From d21d8d46a4be942d34014a920459a4d267419281 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, using COALESCE to prevent mysqlism (IFNULL) and strings for strict SQL. Signed-off-by: Marcel de Rooy Tested on NULL, 0, 1, 2, no, yes. (2 and yes become 0 too. Fine.) Tested strict sql mode: no truncated incorrect DOUBLE value-error anymore. --- 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..8261ce111b 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 COALESCE(value,'0')<>'1'; + }); }, } -- 2.20.1