#33339: TO_CLOB is used for NCLOB fields in Oracle
------------------------------------------+------------------------
               Reporter:  Georgi Yanchev  |          Owner:  nobody
                   Type:  Uncategorized   |         Status:  new
              Component:  Uncategorized   |        Version:  3.2
               Severity:  Normal          |       Keywords:
           Triage Stage:  Unreviewed      |      Has patch:  0
    Needs documentation:  0               |    Needs tests:  0
Patch needs improvement:  0               |  Easy pickings:  0
                  UI/UX:  0               |
------------------------------------------+------------------------
 Consider the model, containing one TextField


 {{{
 from django.db import models

 class Bar(models.Model):
     baz = models.TextField()
 }}}

 When you make a bulk_create request, e.g. Bar.objects.bulk_create([b0,
 b1]) you will get generate a query like below.
 {{{
 INSERT INTO "PROJECT_BAR" ("BAZ") SELECT * FROM (SELECT TO_CLOB(:arg1)
 col_0 FROM DUAL UNION ALL SELECT TO_CLOB(:arg0) FROM DUAL)
 }}}

 This will be accepted by Oracle, but it will create a log file, named
 something like {{{DBNAME_ora_6613.trc}}}, which contains errors:

 {{{
 ORA-12704(1): dty=112 typ=1 flg=00220000 xfl=00040000 bfl=4000 bfc=0
 csfm=2 csid=2000 csflg=0 collid=16382 cclvl=2
 ORA-12704(2): dty=112 typ=2 flg=00230000 xfl=00000000 bfl=4000 bfc=0
 csfm=1 csid=873 csflg=0 collid=16382 cclvl=3 op=184 opc=1
 ORA-12704(2): dty=1 typ=3 flg=00030081 xfl=00040000 bfl=2000 bfc=2000
 csfm=1 csid=873 csflg=0 collid=16382 cclvl=3 styp=1
 }}}

 The problem is that field {{{PROJECT_BAR.BAZ}}} is of type {{{NCLOB}}},
 but Django uses {{{TO_CLOB}}}, instead of {{{TO_NCLOB}}}.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33339>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/057.89a1da5de8b3b87394d4720e51356110%40djangoproject.com.

Reply via email to