Bug 28207

Summary: Crash when seeing MARC structure of a new framework
Product: Koha Reporter: Victor Grousset/tuxayo <victor>
Component: System AdministrationAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: andrewfh, fridolin.somers, gmcharlt, jonathan.druart, julian.maurice, phil
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.06,20.05.12
Bug Depends on:    
Bug Blocks: 17258    
Attachments: Bug 28207: Fix biblio_framework.frameworktext isn't in GROUP BY
Bug 28207: Fix biblio_framework.frameworktext isn't in GROUP BY
Bug 28207: Fix biblio_framework.frameworktext isn't in GROUP BY
Bug 28207: Fix biblio_framework.frameworktext isn't in GROUP BY

Description Victor Grousset/tuxayo 2021-04-23 15:21:38 UTC
== Test plan ==
1. Administration › MARC frameworks => new framework
2. Marc structure
3. Internal server error
DBI Exception: DBD::mysql::st execute failed: 'koha_cover.biblio_framework.frameworktext' isn't in GROUP BY [for Statement "select count(*),marc_tag_structure.frameworkcode,frameworktext from marc_tag_structure,biblio_framework where biblio_framework.frameworkcode=marc_tag_structure.frameworkcode group by marc_tag_structure.frameworkcode"] at /usr/share/perl5/Plack/Component.pm line 50

Doesn't happen to everyone. But happens in PTFS-E's sandboxes for example. (MariaDB 10.1)
On my koha also (MariaDB 10.5)

== sql strict mode ==
Tried toggling sql strict mode but still crashed.
sql_mode
STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

and

| Variable_name | Value |
+---------------+-------+
| sql_mode      |       |

Did a restart_all before retrying in case something weird kept the old mode for Koha.
Comment 1 Jonathan Druart 2021-04-26 08:49:22 UTC
To switch off strict sql modes you need to turn strict_sql_modes off in the koha config.
Comment 2 Jonathan Druart 2021-04-26 08:53:50 UTC
Created attachment 120167 [details] [review]
Bug 28207: Fix biblio_framework.frameworktext isn't in GROUP BY

When a new framework is created and "Marc structure" is opened, a SQL
error happened if sql_strict_mode is on.

Test plan:
Create a 2 new biblio frameworks
Click "Marc structure" for one of them
=> You see the list of all frameworks with an existing structure
Comment 3 David Nind 2021-04-26 21:05:40 UTC
Created attachment 120185 [details] [review]
Bug 28207: Fix biblio_framework.frameworktext isn't in GROUP BY

When a new framework is created and "Marc structure" is opened, a SQL
error happened if sql_strict_mode is on.

Test plan:
Create a 2 new biblio frameworks
Click "Marc structure" for one of them
=> You see the list of all frameworks with an existing structure

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 Victor Grousset/tuxayo 2021-04-27 00:18:04 UTC
Created attachment 120186 [details] [review]
Bug 28207: Fix biblio_framework.frameworktext isn't in GROUP BY

When a new framework is created and "Marc structure" is opened, a SQL
error happened if sql_strict_mode is on.

Test plan:
Create a 2 new biblio frameworks
Click "Marc structure" for one of them
=> You see the list of all frameworks with an existing structure

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 5 Victor Grousset/tuxayo 2021-04-27 00:18:21 UTC
Thanks for the fix :D
Comment 6 Julian Maurice 2021-04-30 08:25:34 UTC
Created attachment 120327 [details] [review]
Bug 28207: Fix biblio_framework.frameworktext isn't in GROUP BY

When a new framework is created and "Marc structure" is opened, a SQL
error happened if sql_strict_mode is on.

Test plan:
Create a 2 new biblio frameworks
Click "Marc structure" for one of them
=> You see the list of all frameworks with an existing structure

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 7 Jonathan Druart 2021-04-30 15:18:01 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 8 Fridolin Somers 2021-05-11 10:15:45 UTC
Pushed to 20.11.x for 20.11.06
Comment 9 Andrew Fuerste-Henry 2021-05-25 11:56:20 UTC
Pushed to 20.05.x for 20.05.12
Comment 10 Victor Grousset/tuxayo 2021-05-25 14:26:06 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.