Bugzilla – Attachment 121912 Details for
Bug 28561
Order_by triggers a DBIx warning Unable to properly collapse has_many results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28561: Resolve DBIx's Unable to collapse results-warning
Bug-28561-Resolve-DBIxs-Unable-to-collapse-results.patch (text/plain), 2.04 KB, created by
Marcel de Rooy
on 2021-06-14 13:45:50 UTC
(
hide
)
Description:
Bug 28561: Resolve DBIx's Unable to collapse results-warning
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2021-06-14 13:45:50 UTC
Size:
2.04 KB
patch
obsolete
>From ba5374bdd6569d935a5b5e9dbb60b7461363356b Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 14 Jun 2021 12:49:06 +0000 >Subject: [PATCH] Bug 28561: Resolve DBIx's Unable to collapse results-warning >Content-Type: text/plain; charset=utf-8 > >[WARN] DBIx::Class::ResultSet::_construct_results(): Unable to properly collapse has_many results in iterator mode due to order criteria - performed an eager cursor slurp underneath. Consider using ->all() instead at /usr/share/koha/Koha/Objects.pm line 335 > >DBIx tells: >If an "order_by" is already declared, and orders the resultset in a way that makes collapsing as described above impossible (e.g. ORDER BY has_many_rel.column or ORDER BY RANDOM()), DBIC will automatically switch to "eager" mode and slurp the entire resultset before constructing the first object returned by "next". > >The query in opac-shelves here prefetches biblio, biblioitems and items. >May order by itemcallnumber (so that is a has_many column). Note that >ordering biblio records (having multiple items) by itemcallnumber >is formally impossible. > >This patch pragmatically removes the order_by clause, but I am open >for a better solution ;) > >Test plan: >Pick a list with biblios having multiple items. >Show the list in OPAC. Change the sortfield. >Check your plack-opac-error.log. >--- > opac/opac-shelves.pl | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl >index 483876188e..87ef4f0e54 100755 >--- a/opac/opac-shelves.pl >+++ b/opac/opac-shelves.pl >@@ -275,7 +275,8 @@ if ( $op eq 'view' ) { > prefetch => [ { 'biblionumber' => { 'biblioitems' => 'items' } } ], > page => $page, > rows => $rows, >- order_by => { "-$direction" => $order_by }, >+ # See BZ 28561 Do not trigger Unable to collapse warning by sorting on items fields >+ $order_by =~ /items/ ? () : ( order_by => { "-$direction" => $order_by } ), > } > ); > >-- >2.20.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 28561
:
121912
|
121913
|
122119
|
122215
|
122743
|
122744