Bug 24593: (follow-up) 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 <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Bernardo Gonzalez Kriegel 2020-03-04 11:31:29 -03:00 committed by Martin Renvoize
parent 0f020eabbd
commit d9b83c12c6
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -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 matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
SELECT MAX(matchpoint_component_id), 1, 'ISBN' FROM matchpoint_components;"
- "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, '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 MAX(matchpoint_id), 1, '022', 'a' FROM matchpoints;"
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, 'ISSN' 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), '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, '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, '999', 'c' 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, 'Biblionumber' FROM matchpoint_components;"
SELECT matchpoint_component_id, 1, 'ISSN' FROM matchpoint_components WHERE tag = '022';"
- "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 matchpoint_id, 1, '999', 'c' FROM matchpoints WHERE search_index = 'local-number';"
- "INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
SELECT matchpoint_component_id, 1, 'Biblionumber' FROM matchpoint_components WHERE tag = '999';"