Hi Florian

No probs, most people don't understand Oracle, it's a bit of a black art. 
Some background: Partly for legacy and partly for justifiable reasons, 
oracle converts blank strings to null.
Back to this issue, as you say, if you implemented the above 
recommendations you would not be able to insert a blank string into 
required fields, but this would be 100% in line with how Oracle works 
anyway. Some DBs handle this differently, and I don't want to start a 
debate around which is better / correct, but my feeling is that one should 
go with the model as described by the DB. i.e. if using Postgres, use the 
Postgres model, when working with Oracle, use the oracle model etc. 

My main concern currently is that required fields are not enforced at the 
db level, which makes using it with other clients difficult. I would much 
prefer that constraints be added, and accept that empty strings cannot be 
inserted into required columns.

Let me know what you think,
Vackar


On Thursday, 8 November 2018 16:10:34 UTC, Florian Apolloner wrote:
>
> On Thursday, November 8, 2018 at 3:52:01 PM UTC+1, vaf...@exscientia.co.uk 
> wrote:
>>
>> - If null=False is specified, then add an explicit not null constraint at 
>> the db level
>>
>
> As far as I understand Oracle makes no difference between null and an 
> empty string. So if we were to add a not-null constraint, you could also no 
> longer insert an empty string; which seems counterintuitive. Note that 
> blank=True/False should be used there as validation on whether or not you 
> want to allow empty values.
>
> This would prevent insertion of blank strings and nulls into required 
>> columns, regardless of the client accessing the DB
>>
>
> Insertion of blank string and null is prevent if you set blank=False and 
> run model validation, isn't it?
>
> I have to say my Oracle knowledge is somewhat limited, so please be 
> patient and explain a bit more if I missunderstand you completly (code 
> examples where you think the behavior is wrong would also help).
>
> Cheers,
> Florian
>

-- 
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/39e60068-d08b-44a2-b37a-d855120dfaf1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to