[Bug 28523] New: Patrons with the most checkouts (bor_issues_top.pl) is failing with MySQL 8
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 Bug ID: 28523 Summary: Patrons with the most checkouts (bor_issues_top.pl) is failing with MySQL 8 Change sponsored?: --- Product: Koha Version: 21.05 Hardware: All OS: All Status: NEW Severity: critical Priority: P5 - low Component: Reports Assignee: koha-bugs@lists.koha-community.org Reporter: development@cm-portimao.pt QA Contact: testopia@bugs.koha-community.org CGI::Compile::ROOT::usr_share_koha_intranet_cgi_2dbin_reports_bor_issues_top_2epl::calculate(): DBI Exception: DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RANK, borrowers.borrowernumber AS ID FROM `old_issues` LEFT JO' at line 1 [for Statement "SELECT CONCAT_WS('', borrowers.surname , ",\t", borrowers.firstname), COUNT(*) AS RANK, borrowers.borrowernumber AS ID FROM `old_issues` LEFT JOIN borrowers USING(borrowernumber) LEFT JOIN items USING(itemnumber) LEFT JOIN biblioitems USING(biblioitemnumber) WHERE old_issues.borrowernumber IS NOT NULL AND old_issues.issuedate > '2021-06-01' AND old_issues.issuedate < '2021-06-07' GROUP BY borrowers.borrowernumber ORDER BY RANK DESC LIMIT 5"] at /usr/share/koha/intranet/cgi-bin/reports/bor_issues_top.pl line 70 Rank is a MySQL reserved word defined in MySQL version 8.0.2 https://dev.mysql.com/doc/refman/8.0/en/keywords.html#keywords-8-0-detailed-... -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=28524 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=23997 CC| |jonathan.druart+koha@gmail. | |com Blocks| |23996 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23996 [Bug 23996] MySQL 8 support [Omnibus] -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|21.05 |unspecified -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 --- Comment #1 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 122037 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=122037&action=edit Bug 28523: Escape 'rank' in bor_issues_top.pl It's a MySQL 8 keyword Test plan: Turn off strict_sql_modes (there are other problems in this script) Hit Home Reports > Patrons with the most checkouts Submit the form Without this patch you got: You have an error in your SQL syntax; check the manual that corresponds to your MySQL s erver version for the right syntax to use near 'RANK, borrowers.borrowernumber AS ID FROM `old_issues` With this patch applied you see the report result view -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |jonathan.druart+koha@gmail. |ity.org |com -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #2 from David Nind <david@davidnind.com> --- I attempted to test this. With MySQL 8 I was able to get this to work following the test plan (starting KTD with ku=my8). However, if I change back to MariaDB (starting KTD with ku) I get a different error message: CGI::Compile::ROOT::kohadevbox_koha_reports_bor_issues_top_2epl::calculate(): DBI Exception: DBD::mysql::st execute failed: 'koha_kohadev.borrowers.surname' isn't in GROUP BY [for Statement "SELECT CONCAT_WS('', borrowers.surname , ",\t", borrowers.firstname), COUNT(*) AS `RANK`, borrowers.borrowernumber AS ID FROM `old_issues` LEFT JOIN borrowers USING(borrowernumber) LEFT JOIN items USING(itemnumber) LEFT JOIN biblioitems USING(biblioitemnumber) WHERE old_issues.borrowernumber IS NOT NULL AND old_issues.issuedate > '2021-06-01' AND old_issues.issuedate < '2021-06-30' AND old_issues.returndate > '2021-06-01' AND old_issues.returndate < '2021-06-30' GROUP BY borrowers.borrowernumber ORDER BY `RANK` DESC LIMIT 5"] at /kohadevbox/koha/reports/bor_issues_top.pl line 70 at /usr/share/perl5/DBIx/Class/Exception.pm line 77 Testing notes (koha-testing-docker): - Start KTD with MySQL 8 (rather than MariaDB): ku-my8 - Turn off strict mode (https://www.linode.com/community/questions/17070/how-can-i-disable-mysql-str...): . access database container: docker exec -it koha_db_1 bash . mysql -uroot -ppassword . SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION'; . SELECT @@GLOBAL.sql_mode; -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 --- Comment #3 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Hi David, The "isn't in GROUP BY" error is happening when strict modes are set. To turn them off you need to edit $KOHA_CONF and set the value for <strict_sql_modes> to 0. Setting them globally is not enough as we are setting them when we initiate the connection to the DB: https://git.koha-community.org/Koha-community/Koha/src/commit/d3ab8dbeec188a... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 --- Comment #4 from David Nind <david@davidnind.com> --- Thanks Jonathan! I can now get this to work with MySQL 8 (ku-my8). With the patch applied in master with MariaDB (ku), I need to turn off strict mode to get this to work. Is that what is expected, or is another bug going to fix this? David -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #122037|0 |1 is obsolete| | --- Comment #5 from Owen Leonard <oleonard@myacpl.org> --- Created attachment 122395 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=122395&action=edit Bug 28523: Escape 'rank' in bor_issues_top.pl It's a MySQL 8 keyword Test plan: Turn off strict_sql_modes (there are other problems in this script) Hit Home Reports > Patrons with the most checkouts Submit the form Without this patch you got: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RANK, borrowers.borrowernumber AS ID FROM `old_issues` With this patch applied you see the report result view Signed-off-by: Owen Leonard <oleonard@myacpl.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #122395|0 |1 is obsolete| | --- Comment #6 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 122417 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=122417&action=edit Bug 28523: Escape 'rank' in bor_issues_top.pl It's a MySQL 8 keyword Test plan: Turn off strict_sql_modes (there are other problems in this script) Hit Home Reports > Patrons with the most checkouts Submit the form Without this patch you got: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RANK, borrowers.borrowernumber AS ID FROM `old_issues` With this patch applied you see the report result view Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | CC| |m.de.rooy@rijksmuseum.nl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |21.11.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 --- Comment #7 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Pushed to master for 21.11, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |Pushed to stable Version(s)|21.11.00 |21.11.00,21.05.02 released in| | CC| |kyle@bywatersolutions.com --- Comment #8 from Kyle M Hall <kyle@bywatersolutions.com> --- Pushed to 21.05.x for 21.05.02 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |victor@tuxayo.net Version(s)|21.11.00,21.05.02 |21.11.00,21.05.02,20.11.08 released in| | Status|Pushed to stable |Pushed to oldstable --- Comment #9 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Hi, Fridolin impostor here. Backported: Pushed to 20.11.x branch for 20.11.08 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to oldstable |Pushed to oldoldstable Version(s)|21.11.00,21.05.02,20.11.08 |21.11.00,21.05.02,20.11.08, released in| |20.05.14 --- Comment #10 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Backported: Pushed to 20.05.x branch for 20.05.14 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 wainuiwitikapark@catalyst.net.nz changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|21.11.00,21.05.02,20.11.08, |21.11.00,21.05.02,20.11.08, released in|20.05.14 |20.05.14,19.11.20 CC| |wainuiwitikapark@catalyst.n | |et.nz Status|Pushed to oldoldstable |Pushed to oldoldoldstable --- Comment #11 from wainuiwitikapark@catalyst.net.nz --- Backported to 19.11.x for 19.11.20 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 --- Comment #12 from David Nind <david@davidnind.com> --- Currently getting this error when running Patrons with the most checkouts report (using KTD started with ku and on master) - is the this the same issue or something else? CGI::Compile::ROOT::kohadevbox_koha_reports_bor_issues_top_2epl::calculate(): DBI Exception: DBD::mysql::st execute failed: 'koha_kohadev.borrowers.surname' isn't in GROUP BY at /kohadevbox/koha/reports/bor_issues_top.pl line 63 at /usr/share/perl5/DBIx/Class/Exception.pm line 77 in DBIx::Class::Exception::throw at /usr/share/perl5/DBIx/Class/Exception.pm line 77 74: my $self = { msg => $msg }; 75: bless $self => $class; 76: 77: die $self; 78: } 79: 80: =head2 rethrow Show function arguments in DBIx::Class::Schema::throw_exception at /usr/share/perl5/DBIx/Class/Schema.pm line 1118 1115: }; 1116: } 1117: 1118: DBIx::Class::Exception->throw($args[0], $self->stacktrace); 1119: } 1120: 1121: =head2 deploy Show function arguments in DBIx::Class::Storage::throw_exception at /usr/share/perl5/DBIx/Class/Storage.pm line 113 110: my $self = shift; 111: 112: if (ref $self and $self->schema) { 113: $self->schema->throw_exception(@_); 114: } 115: else { 116: DBIx::Class::Exception->throw(@_); -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 Michael Hafen <michael.hafen@washk12.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |michael.hafen@washk12.org --- Comment #13 from Michael Hafen <michael.hafen@washk12.org> --- That is something else. The first line of the test plan states that there are other problems with the script, this is the other problem. In SQL Strict mode the query failed the ONLY_FULL_GROUP_BY check. I recently ran into that problem (and created a patch) on another report. (In reply to David Nind from comment #12)
Currently getting this error when running Patrons with the most checkouts report (using KTD started with ku and on master) - is the this the same issue or something else?
CGI::Compile::ROOT::kohadevbox_koha_reports_bor_issues_top_2epl::calculate(): DBI Exception: DBD::mysql::st execute failed: 'koha_kohadev.borrowers.surname' isn't in GROUP BY at /kohadevbox/koha/reports/bor_issues_top.pl line 63 at /usr/share/perl5/DBIx/Class/Exception.pm line 77
in DBIx::Class::Exception::throw at /usr/share/perl5/DBIx/Class/Exception.pm line 77
74: my $self = { msg => $msg }; 75: bless $self => $class; 76: 77: die $self; 78: } 79: 80: =head2 rethrow
Show function arguments in DBIx::Class::Schema::throw_exception at /usr/share/perl5/DBIx/Class/Schema.pm line 1118
1115: }; 1116: } 1117: 1118: DBIx::Class::Exception->throw($args[0], $self->stacktrace); 1119: } 1120: 1121: =head2 deploy
Show function arguments in DBIx::Class::Storage::throw_exception at /usr/share/perl5/DBIx/Class/Storage.pm line 113
110: my $self = shift; 111: 112: if (ref $self and $self->schema) { 113: $self->schema->throw_exception(@_); 114: } 115: else { 116: DBIx::Class::Exception->throw(@_);
-- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 --- Comment #14 from David Nind <david@davidnind.com> --- Thanks Michael! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28523 Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to oldoldoldstable |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org