Opened 9 years ago

Closed 9 years ago

#25962 closed Bug (duplicate)

inspectdb for oracle nvarchar2 could miscalculate field size 2-fold

Reported by: JorisBenschop Owned by: nobody
Component: Database layer (models, ORM) Version: 1.9
Severity: Normal Keywords: Oracle
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've noticed a consistent discrepancy between Oracle tables and django inspectdb results when it comes to NVARCHAR2 data types. Let's say I add this column to my table:

alter table STUDY add (TREATMENT NVARCHAR2(500));

If I then run manage.py inspectdb, I see the following result:

 treatment = models.CharField(max_length=1000, blank=True, null=True)

From the oracle docs:

The NVARCHAR2 datatype is a Unicode-only datatype. When you create a table with an NVARCHAR2 column, you supply the maximum number of characters it can hold.

Now most likely I'm making a calculation mistakes, but to me this seems that the column allows for a 500 character input, whereas Django will allow a 1000 character input instead. If this is indeed the case, I guess this is the result from the 16bit input format that NVARCHAR2 has compared to 8-bit VARCHAR2.

My apologies if this is documented, already reported or just stupidity

Change History (3)

comment:1 by JorisBenschop, 9 years ago

Type: UncategorizedCleanup/optimization

comment:2 by JorisBenschop, 9 years ago

Type: Cleanup/optimizationBug

comment:3 by Tim Graham, 9 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #19884 and #17202.

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