Bug 26548

Summary: [20.05] Update for 20.05.03.001 has wrong SQL
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: Installation and upgrade (web-based installer)Assignee: Lucas Gass (lukeg) <lucas>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: critical    
Priority: P5 - low CC: aleisha, david, fridolin.somers, gmcharlt, jonathan.druart, lucas, mtj
Version: 20.05   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 25958    
Bug Blocks:    
Attachments: Bug 26548: Fix typo in updatedatabase
Bug 26548: Fix typo in updatedatabase

Description Katrin Fischer 2020-09-26 09:50:34 UTC
22386 $DBversion = '20.05.03.001';
22387 if( CheckVersion( $DBversion ) ) {
22388     $dbh->do(q{
22389         INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
22390         ('DefaultLongOverdueSkipLostStatuses', '', NULL, 'Skip these lost statuses by default in longoverdue.pl', 'Free'),
22391     });
22392 
22393     NewVersion( $DBversion, 25958, "Allow LongOverdue cron to exclude specified lost values");
22394 }
Comment 1 Katrin Fischer 2020-09-26 09:57:49 UTC
The comma 'Free'), here should not be.

See email to the mailing list:
https://lists.katipo.co.nz/pipermail/koha/2020-September/055204.html
Comment 2 Jonathan Druart 2020-09-28 11:13:33 UTC
Lucas, can you fix this ASAP please? Then Mason, can you roll a v20.05.04-2 with this patch?
Comment 3 Katrin Fischer 2020-09-28 11:15:55 UTC
Thx, I didn't notice I left this on enhancement.
Comment 4 Lucas Gass (lukeg) 2020-09-28 15:22:26 UTC
Created attachment 110876 [details] [review]
Bug 26548: Fix typo in updatedatabase

Test plan:
1. On 20.05.x run updatedatbase and see an error
2. Apply patch
3. Re-run updatedatabase without an error

https://bugs.koha-community.org/show_bug.cgi?id=25958
Comment 5 David Nind 2020-09-28 18:03:40 UTC
I had a go at testing, but updatedatabase didn't generate any error on 20.05.x for me.
Comment 6 Fridolin Somers 2020-09-29 07:29:35 UTC
I see the error when upgrading from 19.11 :

DBD::mysql::db do failed: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 [for Statement "
        INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
        ('DefaultLongOverdueSkipLostStatuses', '', NULL, 'Skip these lost statuses by default in longoverdue.pl', 'Free'),
    "] at ./src/installer/data/mysql/updatedatabase.pl line 22388.
Comment 7 Fridolin Somers 2020-09-29 07:31:51 UTC
(In reply to Fridolin SOMERS from comment #6)
> I see the error when upgrading from 19.11 :
> 
> DBD::mysql::db do failed: You have an error in your SQL syntax; check the
> manual that corresponds to your MariaDB server version for the right syntax
> to use near '' at line 1 [for Statement "
>         INSERT IGNORE INTO systempreferences ( `variable`, `value`,
> `options`, `explanation`, `type` ) VALUES
>         ('DefaultLongOverdueSkipLostStatuses', '', NULL, 'Skip these lost
> statuses by default in longoverdue.pl', 'Free'),
>     "] at ./src/installer/data/mysql/updatedatabase.pl line 22388.

By changing in installer/data/mysql/updatedatabase.pl :
- local $dbh->{RaiseError} = 0;
+ local $dbh->{RaiseError} = 1;
Comment 8 Fridolin Somers 2020-09-29 07:36:03 UTC
Created attachment 110887 [details] [review]
Bug 26548: Fix typo in updatedatabase

Test plan:
1. On 20.05.x run updatedatbase and see an error
2. Apply patch
3. Re-run updatedatabase without an error

https://bugs.koha-community.org/show_bug.cgi?id=25958
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Comment 9 Fridolin Somers 2020-09-29 07:37:31 UTC
Commit in master in indeed OK :
git show 385a4cba44c5ac56d334d5ac4f8acd69d17375e9
Comment 10 Lucas Gass (lukeg) 2020-09-29 17:50:54 UTC
backported to 20.05.x for 20.05.05
Comment 11 Aleisha Amohia 2020-10-19 22:57:05 UTC
not required in 19.11.x