From 0ab42b1702ae0797dc9247b5a4258edbe27d6c74 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Mon, 15 Nov 2021 14:21:17 -0500 Subject: [PATCH] LP1937294: Fix Sample Data Load Predictability Issue Add "ORDER BY id" to the main queries in the functions used to create call numbers and copies when loading the sample data. This change allows the call numbers and copies to be created in a predictable manner. The necessity of this change was revealed by the failure of the 20-hold-targeter.t Perl live test on PostgreSQL 11+. After this change, that test passes on newer PostgreSQL versions and continues to pass on PostgreSQL 10. Signed-off-by: Jason Stephenson Signed-off-by: Mike Rylander --- Open-ILS/tests/datasets/sql/env_create.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Open-ILS/tests/datasets/sql/env_create.sql b/Open-ILS/tests/datasets/sql/env_create.sql index 9e8d955915..fe9dbea0e5 100644 --- a/Open-ILS/tests/datasets/sql/env_create.sql +++ b/Open-ILS/tests/datasets/sql/env_create.sql @@ -55,7 +55,8 @@ RETURNS void AS $$ FROM biblio.record_entry WHERE id > 0 AND CASE WHEN $3 IS NULL THEN TRUE - ELSE last_xact_id = $3 END; + ELSE last_xact_id = $3 END + ORDER BY id; $$ LANGUAGE SQL; CREATE FUNCTION evergreen.populate_call_number @@ -84,7 +85,8 @@ RETURNS void AS $$ INSERT INTO asset.copy (call_number, circ_lib, creator, editor, loan_duration, fine_level, price, barcode) SELECT id, $1, 1, 1, 1, 1, (SELECT evergreen.generate_price()), $3 || id::text FROM asset.call_number - WHERE record > 0 AND label LIKE $4 || '%' AND owning_lib = $2; + WHERE record > 0 AND label LIKE $4 || '%' AND owning_lib = $2 + ORDER BY id; $$ LANGUAGE SQL; /** Returns the next (by ID) non-deleted asset.copy */ -- 2.11.0