From 37c52367b08f30514483b02a387cb5a463ea15d0 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Fri, 3 May 2013 17:20:17 +0200 Subject: [PATCH] Bug 10185: Fix update 3.09.00.025 It can remove all reserves from reserves table when there is no entries in old_reserves. This is due to @ai which is set to NULL in SET @ai = ( SELECT MAX( reserve_id ) FROM tmp_reserves ) and reserve_id > NULL returns no results in INSERT INTO reserves SELECT * FROM tmp_reserves WHERE reserve_id > @ai Signed-off-by: Kyle M Hall Signed-off-by: Katrin Fischer Test plan and comments on second patch. Signed-off-by: Jared Camins-Esakov --- installer/data/mysql/updatedatabase.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index be4dfa267c..64f0fdec29 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5516,7 +5516,7 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { "); $dbh->do('TRUNCATE reserves'); $dbh->do('ALTER TABLE reserves ADD reserve_id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST'); - $dbh->do('INSERT INTO reserves SELECT * FROM tmp_reserves WHERE reserve_id > @ai'); + $dbh->do('INSERT INTO reserves SELECT * FROM tmp_reserves WHERE reserve_id > COALESCE(@ai, 0)'); $dbh->do('DROP TABLE tmp_reserves'); $dbh->do('COMMIT'); -- 2.39.5