From 3faa7e1103d76c17682850f059e6894e9702c0a5 Mon Sep 17 00:00:00 2001 From: Bernardo Gonzalez Kriegel Date: Wed, 4 Mar 2020 11:31:29 -0300 Subject: [PATCH] Bug 24593: (followup) fix sql statements Original inserted values depends on the order of insertion. This patch rewrites the sql statements to make them order independent Signed-off-by: Jonathan Druart --- .../marc21_default_matching_rules.yml | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.yml b/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.yml index 7dd48f20a6..838360e601 100644 --- a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.yml +++ b/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.yml @@ -48,22 +48,23 @@ tables: threshold: 1000 sql_statements: - - "INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'isbn', 1000 FROM marc_matchers;" - - "INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;" - - "INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) SELECT MAX(matchpoint_id), 1, '020', 'a' FROM matchpoints;" + - "INSERT INTO matchpoints (matcher_id, search_index, score) SELECT matcher_id, 'isbn', 1000 FROM marc_matchers WHERE code = 'ISBN';" + - "INSERT INTO matcher_matchpoints SELECT matcher_id, matchpoint_id FROM matchpoints WHERE search_index = 'isbn';" + - "INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) + SELECT matchpoint_id, 1, '020', 'a' FROM matchpoints WHERE search_index = 'isbn';" - "INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) - SELECT MAX(matchpoint_component_id), 1, 'ISBN' FROM matchpoint_components;" + SELECT matchpoint_component_id, 1, 'ISBN' FROM matchpoint_components WHERE tag = '020';" - - "INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'issn', 1000 FROM marc_matchers;" - - "INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;" + - "INSERT INTO matchpoints (matcher_id, search_index, score) SELECT matcher_id, 'issn', 1000 FROM marc_matchers WHERE code = 'ISSN';" + - "INSERT INTO matcher_matchpoints SELECT matcher_id, matchpoint_id FROM matchpoints WHERE search_index = 'issn';" - "INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) - SELECT MAX(matchpoint_id), 1, '022', 'a' FROM matchpoints;" + SELECT matchpoint_id, 1, '022', 'a' FROM matchpoints WHERE search_index = 'issn';" - "INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) - SELECT MAX(matchpoint_component_id), 1, 'ISSN' FROM matchpoint_components;" + SELECT matchpoint_component_id, 1, 'ISSN' FROM matchpoint_components WHERE tag = '022';" - - "INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'local-number', 1000 FROM marc_matchers;" - - "INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;" + - "INSERT INTO matchpoints (matcher_id, search_index, score) SELECT matcher_id, 'local-number', 1000 FROM marc_matchers WHERE code = 'KohaBiblio';" + - "INSERT INTO matcher_matchpoints SELECT matcher_id, matchpoint_id FROM matchpoints WHERE search_index = 'local-number';" - "INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) - SELECT MAX(matchpoint_id), 1, '999', 'c' FROM matchpoints;" + SELECT matchpoint_id, 1, '999', 'c' FROM matchpoints WHERE search_index = 'local-number';" - "INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) - SELECT MAX(matchpoint_component_id), 1, 'Biblionumber' FROM matchpoint_components;" + SELECT matchpoint_component_id, 1, 'Biblionumber' FROM matchpoint_components WHERE tag = '999';" -- 2.20.1