Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.5.x] Fixed Oracle failure caused by None converted to '' in select…

…_related case

Backpatch of c159d9c
  • Loading branch information...
commit fa1083fb0cfdce0fee4cbbf4d391ddb491223a0f 1 parent 18357bf
@akaariai akaariai authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 django/db/models/query.py
View
11 django/db/models/query.py
@@ -1418,8 +1418,15 @@ def get_cached_row(row, index_start, using, klass_info, offset=0):
fields = row[index_start : index_start + field_count]
# If all the select_related columns are None, then the related
# object must be non-existent - set the relation to None.
- # Otherwise, construct the related object.
- if fields == (None,) * field_count:
+ # Otherwise, construct the related object. Also, some backends treat ''
+ # and None equivalently for char fields, so we have to be prepared for
+ # '' values.
+ if connections[using].features.interprets_empty_strings_as_nulls:
+ vals = tuple([None if f == '' else f for f in fields])
+ else:
+ vals = fields
+
+ if vals == (None,) * field_count:
obj = None
else:
if field_names:
Please sign in to comment.
Something went wrong with that request. Please try again.