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 <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Test plan and comments on second patch.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 37c52367b0)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 254173bc21)

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
This commit is contained in:
Julian Maurice 2013-05-03 17:20:17 +02:00 committed by Chris Cormack
parent baa2d7f049
commit 84d55391cd
1 changed files with 1 additions and 1 deletions

View File

@ -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');