[open-ils-commits] [GIT] Evergreen ILS branch master updated. ba5cb36e165c8274a8a1ed5ad74bd16cf44936e0

Evergreen Git git at git.evergreen-ils.org
Mon Apr 1 21:28:44 EDT 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  ba5cb36e165c8274a8a1ed5ad74bd16cf44936e0 (commit)
      from  5a1ef757c880e931e88cf09c1c6e1234a524206e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ba5cb36e165c8274a8a1ed5ad74bd16cf44936e0
Author: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>
Date:   Tue Mar 19 16:13:35 2013 -0400

    Best hold selection: fix a checkin-busting bug affecting Holds-go-home
    
    Several subselects within SQL auxiliary queries can possibly return
    multiple rows in situations where outer code requires that they return
    only one or zero rows.
    
    When you're using a best-hold order that includes htime or shtime, (such
    as those with Holds-go-home) and if there are mutiple circs or transits
    related to the copy in hand with certain characteristics, you can
    trigger this bug.  The end user at the staff client gets one of those
    nasty "Network error" dialogs, and the error in the SQL logs is:
    
    > ERROR:  more than one row returned by a subquery used as an expression
    
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
index 9e09d19..baa7098 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
@@ -394,7 +394,7 @@ sub build_hold_sort_clause {
 , copy_has_not_been_home AS (
     SELECT (
         -- part 1
-        SELECT circ.id FROM action.circulation circ
+        SELECT MIN(circ.id) FROM action.circulation circ
         JOIN go_home_interval ON (true)
         WHERE
             circ.target_copy = %d AND
@@ -433,7 +433,7 @@ sub build_hold_sort_clause {
     SELECT
         copy_has_not_been_home.response AND (
             -- part 1
-            SELECT atc.id FROM action.transit_copy atc
+            SELECT MIN(atc.id) FROM action.transit_copy atc
             JOIN go_home_interval ON (true)
             WHERE
                 atc.target_copy = %d AND
@@ -441,7 +441,7 @@ sub build_hold_sort_clause {
                 atc.dest_recv_time >= NOW() - go_home_interval.value
         ) IS NULL AND (
             -- part 2
-            SELECT circ.id FROM action.circulation circ
+            SELECT MIN(circ.id) FROM action.circulation circ
             JOIN go_home_interval ON (true)
             WHERE
                 circ.target_copy = %d AND

-----------------------------------------------------------------------

Summary of changes:
 .../Application/Storage/Publisher/action.pm        |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list