[Rt-commit] rt branch, 4.2/oracle-do-not-use-in-operator-for-a-large-list-in-report, created. rt-4.2.10-186-g00f923b

? sunnavy sunnavy at bestpractical.com
Tue Mar 10 15:06:23 EDT 2015


The branch, 4.2/oracle-do-not-use-in-operator-for-a-large-list-in-report has been created
        at  00f923bbedd146c96db425e6679ed45668635ee4 (commit)

- Log -----------------------------------------------------------------
commit 00f923bbedd146c96db425e6679ed45668635ee4
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Mar 11 02:38:37 2015 +0800

    use OR instead of IN when we exceed Oracle's list size limit(<=1000)
    
    otherwise Oracle will error out and not work.
    @match here could be very large.

diff --git a/lib/RT/Report/Tickets.pm b/lib/RT/Report/Tickets.pm
index f605ee2..7657a37 100644
--- a/lib/RT/Report/Tickets.pm
+++ b/lib/RT/Report/Tickets.pm
@@ -487,7 +487,14 @@ sub SetupGroupings {
         # tickets, with no joins.  We then mark it as having been ACL'd,
         # since it was by dint of being in the search results above
         $self->CleanSlate;
-        $self->Limit( FIELD => 'Id', OPERATOR => 'IN', VALUE => \@match );
+        if ( RT->Config->Get( 'DatabaseType' ) eq 'Oracle' && @match > 1000 ) {
+            for my $id ( @match ) {
+                $self->Limit( FIELD => 'Id', VALUE => $id );
+            }
+        }
+        else {
+            $self->Limit( FIELD => 'Id', OPERATOR => 'IN', VALUE => \@match );
+        }
         $self->{'_sql_current_user_can_see_applied'} = 1
     }
 

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


More information about the rt-commit mailing list