[Koha-bugs] [Bug 28561] Order_by triggers a DBIx warning Unable to properly collapse has_many results

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Jun 14 14:35:59 CEST 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28561

--- Comment #2 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
The code in opac-shelves is far from optimal. The prefetch in the query selects
biblio, biblioitems and items. But in the loop starting at L308 we are calling
GetBiblioData, GetMarcBiblio, Biblios->find, GetItemsLocationInfo,
$biblio->items. Horrible ;)

DBIx says about prefetching and collapse the following:
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".

So if we are 'sorting' by itemcallnumber in an "has many" table, we will
trigger the warning. In that case we can remove the sort anyway.

This is a bit lazy 'solution' but this report was not about refactoring
opac-shelves.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list