4 ms·
> An empty string is "no user supplied data" and a null is "no value has been given at all" I assume you meant "an empty string is user supplied an empty strin
by caspar 8y ago
> An empty string is "no user supplied data" and a null is "no value has been given at all"
I assume you meant "an empty string is user supplied an empty string as data".
That aside, you wouldn't normally switch that option on for a field (notice the default is false).
However, Oracle DB stores empty strings as indistinguishable from NULLs[0], so an ORM supporting Oracle DB may want to have some support for converting "empty or null" to an empty string at read time (notice the Oracle specific caveat in the docs in your link).
Once you have that, I'd guess the thinking is that you may as well let devs opt into that behavior (bear in mind that sometimes you're in the position of developing a new app against an existing db, that may or may not have another legacy app reading/writing from it at the same time).
0: https://stackoverflow.com/questions/203493/why-does-oracle-9i-treat-an-empty-string-as-null/203536#203536 https://stackoverflow.com/questions/203493/why-does-oracle-9...
- lowercased 8y ago> I assume you meant "an empty string is user supplied an empty string as data". I think so - it was a bit late. But it's the diff between intentional empty value and unknown/initial value. I still don't grok why django seems to want, by default, to ignore the concept of storing "null" in the database, and makes you jump to non-default configuration to do something which has value (seeing nulls vs empty strings means different things).