Dear Django Team,

The current behaviour of Django with an Oracle backend is to ignore the 
null parameter on CharFields. The implication of this is that all text 
fields are effectively optional, with the justification being that Oracle 
treats nulls and empty strings in a similar manner. I don't believe this is 
a good design approach, to re-iterate the argument from the Django tracker 
(issue 29904): 
I agree that an empty string and a null value are under most circumstances 
interchangeable, but this is being conflated with the concept of 
nullability.
Nullability has nothing to do with the representation of the null, just 
wether or not the field may be null.
i.e If a column has a not null constraint, it should not accept an empty 
string or 'Null' 
With Django's current behaviour, since declaring a field as not null has no 
effect, both 'Null' and blank strings may be inserted without issue.
I would argue that this is a broken design. How are raw queries enforced, 
or additional clients that have no knowledge of the Django's internal 
checks and conversions? 
If Django needs to do internal checks, it should use the value of 'blank' 
and not 'null' to be consistent with other backends. Oracle supports not 
null constraints, why not exploit that?

I would argue that this behaviour should be changed to match the behaviour 
on other backends, where an explicit not null constraint is added to the 
column. 
Is there any reason that this should not be done, other than the 
development effort required to add the constraint. If not would be happy to 
create a PR, provided the request is accepted.

Many Thanks,
Vackar

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/e5a0f360-2d50-46f5-bad4-52d55db5a114%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to