[Koha-bugs] [Bug 9121] New: C4::Serial SQL possible collision on subscription.subscriptionid and subscriptionhistory.subscriptionid

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Nov 20 22:51:05 CET 2012


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9121

            Bug ID: 9121
           Summary: C4::Serial SQL possible collision on
                    subscription.subscriptionid and
                    subscriptionhistory.subscriptionid
    Classification: Unclassified
 Change sponsored?: ---
           Product: Koha
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P5 - low
         Component: Serials
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: chrish at catalyst.net.nz
                CC: colin.campbell at ptfs-europe.com

In C4::serials a few queries use queries of the form
SELECT subscription.*, subscriptionhistory.*
FROM subscription
LEFT JOIN subscriptionhisotry USING(subscriptionid)

If there are is a subscription without a matching subscriptionhistory then this
join results in
subscription.subscriptionid | subscriptionhistory.subscriptionid
----------------------------------------------------------------
1234                        |  NULL

Once this is fetched and squashed in to a hashref (for example, via
fetchall_arrayref) this will be
{ subscriptionid => undef }

This implicitly requires that every subscription has a matching
subscriptionhistory.

If we change the subscriptionhistory.* to select only the parts we need then we
can avoid this issue.

For SearchSubscription (which is only used by serials/serials-search.pl) none
of the columns from subscriptionhistory appear to be used.

We could also add a 'subscription.subscriptionid' to the end of the select, but
this seems less clean.

-- 
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