Bug 28207 - Crash when seeing MARC structure of a new framework
Summary: Crash when seeing MARC structure of a new framework
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 17258
  Show dependency treegraph
 
Reported: 2021-04-23 15:21 UTC by Victor Grousset/tuxayo
Modified: 2021-05-25 14:26 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.06,20.05.12


Attachments
Bug 28207: Fix biblio_framework.frameworktext isn't in GROUP BY (3.06 KB, patch)
2021-04-26 08:53 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 28207: Fix biblio_framework.frameworktext isn't in GROUP BY (3.12 KB, patch)
2021-04-26 21:05 UTC, David Nind
Details | Diff | Splinter Review
Bug 28207: Fix biblio_framework.frameworktext isn't in GROUP BY (3.16 KB, patch)
2021-04-27 00:18 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 28207: Fix biblio_framework.frameworktext isn't in GROUP BY (3.22 KB, patch)
2021-04-30 08:25 UTC, Julian Maurice
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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.