Ticket #21001: oracle_bug_21001_django_1.4.14.diff

File oracle_bug_21001_django_1.4.14.diff, 1019 bytes (added by Pauli Sundberg, 10 years ago)

Patch for Django 1.4.14 to fix #21001

  • django/db/models/sql/query.py

    diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
    index ce11716..322669a 100644
    a b class Query(object):  
    11011101            # If value is a query expression, evaluate it
    11021102            value = SQLEvaluator(value, self)
    11031103            having_clause = value.contains_aggregate
     1104           
     1105        # For Oracle '' is equivalent to null. The check needs to be done
     1106        # at this stage because join promotion can't be done at compiler
     1107        # stage. Using DEFAULT_DB_ALIAS isn't nice, but it is the best we
     1108        # can do here. Similar thing is done in is_nullable(), too.
     1109        if (connections[DEFAULT_DB_ALIAS].features.interprets_empty_strings_as_nulls and
     1110                lookup_type == 'exact' and value == ''):
     1111            value = True
     1112            lookup_type = 'isnull'
    11041113
    11051114        for alias, aggregate in self.aggregates.items():
    11061115            if alias in (parts[0], LOOKUP_SEP.join(parts)):
Back to Top