Bug 34684 - 220600007.pl is failing if run twice
Summary: 220600007.pl is failing if run twice
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Installation and upgrade (command-line installer) (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Kyle M Hall
URL:
Keywords:
Depends on: 29129
Blocks: 34683
  Show dependency treegraph
 
Reported: 2023-09-01 07:44 UTC by Jonathan Druart
Modified: 2023-12-28 20:47 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.04,22.11.10


Attachments
Bug 34684: Prevent 220600007.pl to fail if run twice (1.52 KB, patch)
2023-09-01 07:49 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 34684: Prevent 220600007.pl to fail if run twice (1.57 KB, patch)
2023-09-06 14:10 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 34684: Prevent 220600007.pl to fail if run twice (1.67 KB, patch)
2023-09-06 14:36 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2023-09-01 07:44:40 UTC
ERROR 1292 (22007): Truncated incorrect DECIMAL value: 'no'
Comment 1 Jonathan Druart 2023-09-01 07:49:42 UTC
Created attachment 155056 [details] [review]
Bug 34684: Prevent 220600007.pl to fail if run twice

The error is
  ERROR 1292 (22007): Truncated incorrect DECIMAL value: 'no'

Happens on MariaDB 10.5.22, not MySQL 8

Test plan:
update systempreferences set value="0" where variable="DisplayClearScreenButton";
play installer/data/mysql/db_revs/220600007.pl
select value from systempreferences where variable="DisplayClearScreenButton";
=> "no"

update systempreferences set value="1" where variable="DisplayClearScreenButton";
play installer/data/mysql/db_revs/220600007.pl
select value from systempreferences where variable="DisplayClearScreenButton";
=> "issueslip"
Comment 2 David Cook 2023-09-06 00:44:06 UTC
How do you "play installer/data/mysql/db_revs/220600007.pl"? I can't run it on its own using Perl. Do we need to set Version to a particular number or something else?
Comment 3 Jonathan Druart 2023-09-06 07:02:40 UTC
(In reply to David Cook from comment #2)
> How do you "play installer/data/mysql/db_revs/220600007.pl"? I can't run it
> on its own using Perl. Do we need to set Version to a particular number or
> something else?

Run the UPDATE query that is there.
Comment 4 David Cook 2023-09-06 07:20:33 UTC
(In reply to Jonathan Druart from comment #3)
> (In reply to David Cook from comment #2)
> > How do you "play installer/data/mysql/db_revs/220600007.pl"? I can't run it
> > on its own using Perl. Do we need to set Version to a particular number or
> > something else?
> 
> Run the UPDATE query that is there.

That won't trigger the DB update though and you can't run installer/data/mysql/db_revs/220600007.pl directly.

I was testing a different bug of yours after this one and I came up with a test plan that I used, so tomorrow I could look at finding that and copying it over here...
Comment 5 Jonathan Druart 2023-09-06 09:13:25 UTC
Well, the change is pretty straightforward. We just want to make sure surrounding 1 with double quote won't change the result.
Comment 6 Marcel de Rooy 2023-09-06 10:50:25 UTC
You can just copy the dbrev to atomicupdate to play it again.
Dont forget to remove it later.
Comment 7 Marcel de Rooy 2023-09-06 11:23:34 UTC
(In reply to Jonathan Druart from comment #1)
> Happens on MariaDB 10.5.22, not MySQL 8

Cannot reproduce on 10.5.19.
Any pointers to do so? Specific SQL modes? Etc.

Both old and new version run twice without error message.
Comment 8 Jonathan Druart 2023-09-06 12:24:56 UTC
Fresh ktd, origin/master

Server version: 10.5.22-MariaDB-1:10.5.22+maria~ubu2004 mariadb.org binary distribution

MariaDB [koha_kohadev]> select value from systempreferences where variable="DisplayClearScreenButton";
+-------+
| value |
+-------+
| no    |
+-------+
1 row in set (0.000 sec)

MariaDB [koha_kohadev]> UPDATE systempreferences             SET                 options = 'no|issueslip|issueqslip',                    type = 'Choice',                   value = CASE value
        WHEN 1 THEN 'issueslip'                               ELSE 'no'                           END;
ERROR 1292 (22007): Truncated incorrect DECIMAL value: ''

Nothing else.
Comment 9 Kyle M Hall 2023-09-06 14:10:38 UTC
Created attachment 155275 [details] [review]
Bug 34684: Prevent 220600007.pl to fail if run twice

The error is
  ERROR 1292 (22007): Truncated incorrect DECIMAL value: 'no'

Happens on MariaDB 10.5.22, not MySQL 8

Test plan:
update systempreferences set value="0" where variable="DisplayClearScreenButton";
play installer/data/mysql/db_revs/220600007.pl
select value from systempreferences where variable="DisplayClearScreenButton";
=> "no"

update systempreferences set value="1" where variable="DisplayClearScreenButton";
play installer/data/mysql/db_revs/220600007.pl
select value from systempreferences where variable="DisplayClearScreenButton";
=> "issueslip"

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 10 Marcel de Rooy 2023-09-06 14:34:37 UTC
(In reply to Jonathan Druart from comment #8)
> MariaDB [koha_kohadev]> UPDATE systempreferences             SET            
> options = 'no|issueslip|issueqslip',                    type = 'Choice',    
> value = CASE value
>         WHEN 1 THEN 'issueslip'                               ELSE 'no'     
> END;

Wouldnt recommend this update (without WHERE)..

I see the error now too.
Upgrade to 22.06.00.007  [14:34:13]: Bug 29129 - Update the DisplayClearnScreenButton system pref to allow for a choice between ISSUESLIP and ISSUEQSLIP
ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Truncated incorrect DECIMAL value: 'no' at /usr/share/koha/C4/Installer.pm line 741
Comment 11 Marcel de Rooy 2023-09-06 14:36:28 UTC
Created attachment 155276 [details] [review]
Bug 34684: Prevent 220600007.pl to fail if run twice

The error is
  ERROR 1292 (22007): Truncated incorrect DECIMAL value: 'no'

Happens on MariaDB 10.5.22, not MySQL 8

Test plan:
update systempreferences set value="0" where variable="DisplayClearScreenButton";
play installer/data/mysql/db_revs/220600007.pl
select value from systempreferences where variable="DisplayClearScreenButton";
=> "no"

update systempreferences set value="1" where variable="DisplayClearScreenButton";
play installer/data/mysql/db_revs/220600007.pl
select value from systempreferences where variable="DisplayClearScreenButton";
=> "issueslip"

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 12 Tomás Cohen Arazi 2023-09-06 18:11:01 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 13 Fridolin Somers 2023-09-08 19:26:57 UTC
Pushed to 23.05.x for 23.05.04
Comment 14 Matt Blenkinsop 2023-09-15 09:51:05 UTC
Nice work everyone!

Pushed to oldstable for 22.11.x