Dear Django Team,

CharField on an Oracle backend has some strange behaviour. Because oracle 
treats empty strings and nulls in a similar fashion, Django simply ignore 
the null parameter (which should control nullability) on the field.

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?

If this would be accepted, would be happy to create a PR. What are your 
thoughts?

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/3d4d214d-e1f5-4568-9382-d4f58dba4a86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to