On Monday, June 18, 2012 2:17:26 PM UTC-6, André Pang wrote:
>
> Hi all,
>
> The Django Oracle documentation has the following to say about NULL and 
> empty 
> strings<https://docs.djangoproject.com/en/1.1/ref/databases/#null-and-empty-strings>
>  (emphasis 
> mine):
>
> Django generally prefers to use the empty string ('') rather than NULL, 
>> but Oracle treats both identically. To get around this, the Oracle backend 
>> coerces the null=True option *on fields that have the empty string as a 
>> possible value*.
>
>
> However, I've found that the Oracle schema that Django generates *always 
> *allows 
> NULLs on all string-like fields (CharField, TextField, FilePathField, etc).
>

Because those are all "fields that have the empty string as a possible 
value".

 

> I'd assume that Django would only generate schemas where NULL is allowed 
> for fields where blank=True, and that fields where blank=False would have 
> "NOT NULL" included in the Oracle DDL.
>

blank=True is a validation option, not a database option.  A field with 
blank=False can still have the empty string as a possible value, and it can 
be stored like that in any of the other backends; it's just not accepted by 
the admin site.  In this case it's mainly a cross-compatibility issue -- if 
an app stores the empty string on a blank=False field in Postgres, it 
should be able to do that when the backend is Oracle as well.

Cheers,
Ian

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/OQ1fVBapZSoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to