mirror of
https://github.com/django/django.git
synced 2025-12-01 07:48:28 +00:00
Fixed #20091 -- Oracle null promotion for empty strings
This commit is contained in:
parent
a4b8a4b632
commit
e17fa9e877
2 changed files with 16 additions and 1 deletions
|
|
@ -1078,6 +1078,14 @@ class Query(object):
|
|||
elif isinstance(value, ExpressionNode):
|
||||
# If value is a query expression, evaluate it
|
||||
value = SQLEvaluator(value, self, reuse=can_reuse)
|
||||
# For Oracle '' is equivalent to null. The check needs to be done
|
||||
# at this stage because join promotion can't be done at compiler
|
||||
# stage. Using DEFAULT_DB_ALIAS isn't nice, but it is the best we
|
||||
# can do here. Similar thing is done in is_nullable(), too.
|
||||
if (connections[DEFAULT_DB_ALIAS].features.interprets_empty_strings_as_nulls and
|
||||
lookup_type == 'exact' and value == ''):
|
||||
value = True
|
||||
lookup_type = 'isnull'
|
||||
|
||||
for alias, aggregate in self.aggregates.items():
|
||||
if alias in (parts[0], LOOKUP_SEP.join(parts)):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue