Opened 14 years ago
Closed 14 years ago
#14107 closed (invalid)
Problem with non-null fieds using Oracle Backend
Reported by: | Marcos Daniel Petry | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hi,
I have a problem with Oracle Backend when I generate the SQL script to build the database structure
Some fields (I don't know why :P) didn't set the "NOT NULL" attribute on SQL scripts for Oracle Database, for PostgreSQL database work fine. Even if I set the Blank and Null attributes to false in my models.py
Here is a snippet of my models.py: http://dpaste.org/ovwp/
and here, the Oracle SQL Script: http://dpaste.org/fwnq/
and PostgreSQL script: http://dpaste.org/kYEN/
Change History (3)
comment:1 by , 14 years ago
follow-up: 3 comment:2 by , 14 years ago
comment:3 by , 14 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
This is intended behavior, as noted in the docs:
When using the Oracle database backend, the null=True option will be coerced for string-based fields that have the empty string as a possible value, and the value NULL will be stored to denote the empty string.
This is because Oracle treats the empty string and NULL as the same thing, and a CharField can be used to store the empty string even with null=True, blank=True. If you really want the column to be NOT NULL, you need to set it manually.
Sorry, I posted a sqlite script instead of postgresql script, here is the right scripts:
PostgreSQL: http://dpaste.org/CrYw/
SQLite http://dpaste.org/Ybf7/
Replying to mdpetry: