Bugzilla – Attachment 125124 Details for
Bug 28977
Most-circulated items (cat_issues_top.pl) is failing with SQL Mode ONLY_FULL_GROUP_BY
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch
0001-Bug-28977-Add-GROUP_CONCAT-to-some-of-the-selected-c.patch (text/plain), 3.28 KB, created by
Michael Hafen
on 2021-09-21 21:40:06 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Michael Hafen
Created:
2021-09-21 21:40:06 UTC
Size:
3.28 KB
patch
obsolete
>From 9a8c881b58420d5420b28e03b4ee9c7becf0e560 Mon Sep 17 00:00:00 2001 >From: Michael Hafen <michael.hafen@washk12.org> >Date: Wed, 8 Sep 2021 14:55:27 -0600 >Subject: [PATCH 1/3] Bug 28977 - Add GROUP_CONCAT to some of the selected > columns >Content-Type: text/plain; charset="utf-8" > >To get the 'Most circulated items' report to run in ONLY_FULL_GROUP_BY >Sql mode. > >Test plan: > >Turn on strict_sql_modes ( make sure <strict_sql_modes> is 1 in KOHA_CONF ) >Go to Reports -> Most circulated items >submit the form. > >Without the patch you get an error like: >CGI::Compile::ROOT::usr_local_koha_master_reports_cat_issues_top_2epl::calculate(): DBI Exception: DBD::mysql::st execute failed: Expression #4 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'koha_main_v4.items.itemcallnumber' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by [for Statement "SELECT DISTINCT biblio.title, COUNT(biblio.biblionumber) AS `RANK`, biblio.biblionumber AS ID, itemcallnumber as CALLNUM, ccode as CCODE, location as LOC FROM `old_issues` > LEFT JOIN items USING(itemnumber) > LEFT JOIN biblio USING(biblionumber) > LEFT JOIN biblioitems USING(biblionumber) > LEFT JOIN borrowers USING(borrowernumber) > WHERE 1 AND old_issues.issuedate > '2020-08-03' AND old_issues.issuedate < '2021-05-17' AND old_issues.returndate > '2020-08-27' AND old_issues.returndate < '2021-06-01' AND old_issues.branchcode like '403' AND items.itype like 'F' AND ccode like 'FIC' AND borrowers.categorycode like 'ST' group by biblio.biblionumber order by `RANK` DESC"] at /usr/local/koha_master/reports/cat_issues_top.pl line 67 > at /usr/share/perl5/DBIx/Class/Exception.pm line 77 > >With the patch you will see the report results view. >--- > reports/cat_issues_top.pl | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > >diff --git a/reports/cat_issues_top.pl b/reports/cat_issues_top.pl >index a15a79bec6..f7bff28a23 100755 >--- a/reports/cat_issues_top.pl >+++ b/reports/cat_issues_top.pl >@@ -299,10 +299,10 @@ sub calculate { > > # Processing average loanperiods > $strcalc .= "SELECT DISTINCT biblio.title, COUNT(biblio.biblionumber) AS `RANK`, biblio.biblionumber AS ID"; >- $strcalc .= ", itemcallnumber as CALLNUM"; >- $strcalc .= ", ccode as CCODE"; >- $strcalc .= ", location as LOC"; >- $strcalc .= " , $colfield " if ($colfield); >+ $strcalc .= ", GROUP_CONCAT(DISTINCT itemcallnumber) as CALLNUM"; >+ $strcalc .= ", GROUP_CONCAT(DISTINCT ccode) as CCODE"; >+ $strcalc .= ", GROUP_CONCAT(DISTINCT location) as LOC"; >+ $strcalc .= " , GROUP_CONCAT(DISTINCT $colfield) " if ($colfield); > $strcalc .= " FROM `old_issues` > LEFT JOIN items USING(itemnumber) > LEFT JOIN biblio USING(biblionumber) >@@ -344,7 +344,7 @@ sub calculate { > @$filters[12]=~ s/\*/%/g if (@$filters[12]); > $strcalc .= " AND year(old_issues.issuedate) like '" . @$filters[12] ."'" if ( @$filters[12] ); > >- $strcalc .= " group by biblio.biblionumber"; >+ $strcalc .= " group by biblio.biblionumber,biblio.title"; > $strcalc .= ", $colfield" if ($column); > $strcalc .= " order by `RANK` DESC"; > $strcalc .= ", $colfield " if ($colfield); >-- >2.25.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28977
:
124664
|
125124
|
125208
|
128684
|
129510
|
129982
|
130081