Bug 35442 - Script migration_tools/build_oai_sets.pl is missing ORDER BY
Summary: Script migration_tools/build_oai_sets.pl is missing ORDER BY
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Web services (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Fridolin Somers
QA Contact: Julian Maurice
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-29 19:52 UTC by Fridolin Somers
Modified: 2024-11-18 22:19 UTC (History)
4 users (show)

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


Attachments
Bug 35442: Script migration_tools/build_oai_sets.pl add ORDER BY (1.16 KB, patch)
2023-11-29 19:55 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 35442: Script migration_tools/build_oai_sets.pl add ORDER BY (1.21 KB, patch)
2024-05-15 14:37 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 35442: Script migration_tools/build_oai_sets.pl add ORDER BY (1.27 KB, patch)
2024-09-20 13:06 UTC, Julian Maurice
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2023-11-29 19:52:20 UTC
Script migration_tools/build_oai_sets.pl is missing ORDER BY biblionumber.
This is a problem when using OFFSET and LIMIT, the results may be differenly orderder between two calls of this script.
Comment 1 Fridolin Somers 2023-11-29 19:55:33 UTC
Created attachment 159367 [details] [review]
Bug 35442: Script migration_tools/build_oai_sets.pl add ORDER BY

Script migration_tools/build_oai_sets.pl is missing ORDER BY biblionumber.
This is a problem when using OFFSET and LIMIT, the results may be differenly orderder between two calls of this script.

Test plan :
1) Create a OAI SET with all records
2) Run migration_tools/build_oai_sets.pl with the first half of records
3) Run migration_tools/build_oai_sets.pl with the second half of records
4) Check all records are in the OAI set
Comment 2 Lucas Gass (lukeg) 2024-05-15 14:37:24 UTC
Created attachment 166783 [details] [review]
Bug 35442: Script migration_tools/build_oai_sets.pl add ORDER BY

Script migration_tools/build_oai_sets.pl is missing ORDER BY biblionumber.
This is a problem when using OFFSET and LIMIT, the results may be differenly orderder between two calls of this script.

Test plan :
1) Create a OAI SET with all records
2) Run migration_tools/build_oai_sets.pl with the first half of records
3) Run migration_tools/build_oai_sets.pl with the second half of records
4) Check all records are in the OAI set

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 3 Julian Maurice 2024-09-20 13:06:33 UTC
Created attachment 171830 [details] [review]
Bug 35442: Script migration_tools/build_oai_sets.pl add ORDER BY

Script migration_tools/build_oai_sets.pl is missing ORDER BY
biblionumber.
This is a problem when using OFFSET and LIMIT, the results may be
differenly orderder between two calls of this script.

Test plan :
1) Create a OAI SET with all records
2) Run migration_tools/build_oai_sets.pl with the first half of records
3) Run migration_tools/build_oai_sets.pl with the second half of records
4) Check all records are in the OAI set

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 4 Julian Maurice 2024-09-20 13:11:21 UTC
The patch is from BibLibre but it's a bugfix that has been in the QA queue for 4 months. I hope it's okay that I QA it. Feel free to ask for another QA.

QA notes: I wasn't sure so I checked but the ORDER BY is indeed applied to the whole resultset and not only the last select of the union (https://mariadb.com/kb/en/union/#order-by-and-limit)
Comment 5 Martin Renvoize (ashimema) 2024-09-26 19:05:59 UTC
Thanks Julian, 

I agree, all good for you're QA here.  Shame it dropped through the queue and out of sight. :(
Comment 6 Martin Renvoize (ashimema) 2024-09-30 14:33:50 UTC
Thanks for all the hard work!

Pushed to main for the next 24.11.00 release as RM Assistant
Comment 7 Lucas Gass (lukeg) 2024-11-18 22:19:29 UTC
Backported to 24.05.x for upcoming 24.05.06