Bug 24030 - GetItemsForInventory failing with "ORDER BY clause is not in SELECT list"
Summary: GetItemsForInventory failing with "ORDER BY clause is not in SELECT list"
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 24002
  Show dependency treegraph
 
Reported: 2019-11-13 10:07 UTC by Jonathan Druart
Modified: 2021-06-14 21:29 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00
Circulation function:


Attachments
Bug 24030: Remove OldWay comparaison from GetItemsForInventory.t (6.50 KB, patch)
2019-11-13 10:12 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 24030: Fix GetItemsForInventory under MySQL 8 (1.91 KB, patch)
2019-11-13 10:12 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 24030: Remove OldWay comparaison from GetItemsForInventory.t (6.55 KB, patch)
2019-11-13 13:25 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 24030: Fix GetItemsForInventory under MySQL 8 (1.97 KB, patch)
2019-11-13 13:25 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2019-11-13 10:07:22 UTC
t/db_dependent/Items/GetItemsForInventory.t .. 1/9 DBD::mysql::st execute failed: Expression #1 of ORDER BY clause is not in SELECT list, references column 'koha_kohadev.items.cn_sort' which is not in SELECT list; this is incompatible with DISTINCT [for Statement "
        SELECT DISTINCT(items.itemnumber), barcode, itemcallnumber, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, withdrawn, stocknumber

        FROM items
        LEFT JOIN biblio ON items.biblionumber = biblio.biblionumber
        LEFT JOIN biblioitems on items.biblionumber = biblioitems.biblionumber
     ORDER BY items.cn_sort, itemcallnumber, title"] at /kohadevbox/koha/C4/Items.pm line 838.
Comment 1 Jonathan Druart 2019-11-13 10:12:45 UTC
Created attachment 95356 [details] [review]
Bug 24030: Remove OldWay comparaison from GetItemsForInventory.t

This has been introduced to make sure there were no regression at a
given point. But now we are fixing the "old way" so it does not make
sense to keep it any longer
Comment 2 Jonathan Druart 2019-11-13 10:12:50 UTC
Created attachment 95357 [details] [review]
Bug 24030: Fix GetItemsForInventory under MySQL 8

t/db_dependent/Items/GetItemsForInventory.t .. 1/9 DBD::mysql::st execute failed: Expression #1 of ORDER BY clause is not in SELECT list, references column 'koha_kohadev.items.cn_sort' which is not in SELECT list; this is incompatible with DISTINCT [for Statement "
        SELECT DISTINCT(items.itemnumber), barcode, itemcallnumber, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, withdrawn, stocknumber

        FROM items
        LEFT JOIN biblio ON items.biblionumber = biblio.biblionumber
        LEFT JOIN biblioitems on items.biblionumber = biblioitems.biblionumber
     ORDER BY items.cn_sort, itemcallnumber, title"] at /kohadevbox/koha/C4/Items.pm line 838.

We simply follow what the error says, and add items.cn_sort to the SELECT list
Comment 3 Martin Renvoize (ashimema) 2019-11-13 13:24:57 UTC
Good catch, obvious corrections. Passing QA and Pushing.
Comment 4 Martin Renvoize (ashimema) 2019-11-13 13:25:51 UTC
Created attachment 95377 [details] [review]
Bug 24030: Remove OldWay comparaison from GetItemsForInventory.t

This has been introduced to make sure there were no regression at a
given point. But now we are fixing the "old way" so it does not make
sense to keep it any longer

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize (ashimema) 2019-11-13 13:25:54 UTC
Created attachment 95378 [details] [review]
Bug 24030: Fix GetItemsForInventory under MySQL 8

t/db_dependent/Items/GetItemsForInventory.t .. 1/9 DBD::mysql::st execute failed: Expression #1 of ORDER BY clause is not in SELECT list, references column 'koha_kohadev.items.cn_sort' which is not in SELECT list; this is incompatible with DISTINCT [for Statement "
        SELECT DISTINCT(items.itemnumber), barcode, itemcallnumber, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, withdrawn, stocknumber

        FROM items
        LEFT JOIN biblio ON items.biblionumber = biblio.biblionumber
        LEFT JOIN biblioitems on items.biblionumber = biblioitems.biblionumber
     ORDER BY items.cn_sort, itemcallnumber, title"] at /kohadevbox/koha/C4/Items.pm line 838.

We simply follow what the error says, and add items.cn_sort to the SELECT list

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 6 Martin Renvoize (ashimema) 2019-11-13 13:26:25 UTC
Nice work!

Pushed to master for 19.11.00