Opened 17 years ago
Closed 17 years ago
#5219 closed (wontfix)
Problems using syncdb with Oracle 10g - strange field names and null = false ignored
Reported by: | anonymous | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Hello
When syncdbing the following model :
class IdentificationConfidence(models.Model): identification_confidence = models.CharField("how confident the observer is", max_length = 20, null = False) class Meta: app_label = 'interaction' def __unicode__(self): return self.identification_confidence
I get the following table produced:
INTERACTION_IDENTIFICATION8A86
with fields ID (PK) and
IDENTIFICATION_CONFIDENCE NVARCHAR2(20) Nullable = Yes
Syncdb seems to be ignoring null = false and providing a strange table name
Thanks
Catriona
NB I didn't type the the question marks into my issue - they just appeared and it was __unicode__
Change History (3)
comment:1 by , 17 years ago
Description: | modified (diff) |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 17 years ago
Ignoring null=False for string-based fields in Oracle is intentional. Oracle considers the empty string to be a synonym of null, so we coerce null=True in order to be able to store the empty string.
We considered allowing this behavior to be overridden by explicitly specifying null=False, but we decided it was more important that null=False should have the same behavior regardless of whether it is implicit or explicit. I'm open to other suggestions, though.
comment:3 by , 17 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
We document the Oracle null=True for CharField decision at http://www.djangoproject.com/documentation/model-api/#null so in the absence of contrary suggestions, I'm closing this bug.
(Fixed wiki formatting in description.)
The modified table name is nothing to worry about. There's a maximum length on table names in Oracle, so we truncate them and a unique hash to the end.
The other bit (ignore null=False) is something I'll let the Oracle maintainers worry about.