Bug 34223: Work around ONLY_FULL_GROUP_BY in Illbackend
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 10 Jul 2023 17:03:34 +0000 (17:03 +0000)
committerMatt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Fri, 15 Sep 2023 09:50:34 +0000 (09:50 +0000)
commit1f9f67efb4a3970f73ff50e97e93dbac26ee2730
tree323dc1a4c1b7950e4f41a6285a63701487aafd2b
parent4fe259f19d32411f99fd124dfe8a4ee3a4676194
Bug 34223: Work around ONLY_FULL_GROUP_BY in Illbackend

This patch re-works the query in the existing_statuses method to remove
the FIXME and improve performance.  We pass an SQL literal into the
query to make it explicit which illrequest_id we're looking for (which
dampens the SQL warning) even though we really don't mind which request
is returned here.

Test plan:

The following command will (hopefully) reset your ILL data and create 10k fake ILL requests (run this in DEV KTD only).

1) On an empty k-t-d, run:
bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev-data.sh)
2) Pet a cat
3) Visit /cgi-bin/koha/ill/ill-requests.pl and select a backend on the left side filters
4) Notice how the status filter takes a while (3-5 secs) to load
5) Apply patch and koha-plack --restart kohadev
6) Repeat 3, notice how the status filter now loads fast

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 87d1b1fdb61ea27effbac654d55923bf6abbe1ab)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit c145f874eb5695433dd3297400f9bc784932892a)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Koha/Illbackend.pm