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 Malcolm Tredinnick)

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 Malcolm Tredinnick, 17 years ago

Description: modified (diff)
Triage Stage: UnreviewedAccepted

(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.

comment:2 by Erin Kelly, 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 Matt Boersma, 17 years ago

Resolution: wontfix
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top