[Koha-bugs] [Bug 24741] New: Recent creation of unique index on library_groups erroneously removes rows

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Feb 27 12:46:22 CET 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24741

            Bug ID: 24741
           Summary: Recent creation of unique index on library_groups
                    erroneously removes rows
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: critical
          Priority: P5 - low
         Component: Architecture, internals, and plumbing
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: stefan.berndtsson at ub.gu.se
        QA Contact: testopia at bugs.koha-community.org

Bug 21674 introduces a new unique index on library_groups. Before this is done,
removal of duplicate entries is done. This check for duplicates is wrong and
removes non-duplicate entries as well.

The query being executed is:

DELETE FROM library_groups
WHERE id NOT IN (
  SELECT MIN(id)
  FROM ( SELECT * FROM library_groups ) AS lg
  WHERE parent_id IS NOT NULL
  GROUP BY parent_id, branchcode
)
AND parent_id IS NOT NULL;


To test:

Use Administration/Library groups, add two group on the same level. Add a
library or two in each of them, then run the above query.

The second of the two groups, including all its libraries will now be removed.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list