Opened 8 years ago

Closed 8 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: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by mtredinnick)

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 Changed 8 years ago by mtredinnick

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

(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 Changed 8 years ago by ikelly

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 Changed 8 years ago by mboersma

  • Resolution set to wontfix
  • Status changed from new to 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.

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