#24012: models.UUIDfield fails on Oracle backend
-------------------------------------+-------------------------------------
     Reporter:  JorisBenschop        |      Owner:  nobody
         Type:  Uncategorized        |     Status:  new
    Component:  Database layer       |    Version:  master
  (models, ORM)                      |   Keywords:  oracle,
     Severity:  Normal               |  models.UUIDfield
 Triage Stage:  Unreviewed           |  Has patch:  0
Easy pickings:  0                    |      UI/UX:  0
-------------------------------------+-------------------------------------
 Hi, my employers uses RAW(16) as a pk for all tables (using the SYS_GUID()
 function). This gives blocking issues in Django as Django keeps on trying
 to decode()  this field. However, using models.UUIDfield does not resovle
 the issue:

 {{{
 class Population(models.Model):
     population_id = models.UUIDField(primary_key=True)
     population_name = models.CharField(max_length=400)

 x=Population.objects.all()[0]
 Traceback (most recent call last):
 File "/home/gfjom/wingide4/lib/src/debug/tserver/_sandbox.py", line 1, in
 <module>
     # Used internally for debug sandbox under external interpreter
   File "/home/gfjom/django-virtualenv/lib/python2.7/site-
 packages/Django-1.8-py2.7.egg/django/db/models/query.py", line 203, in
 __getitem__
     return list(qs)[0]
   File "/home/gfjom/django-virtualenv/lib/python2.7/site-
 packages/Django-1.8-py2.7.egg/django/db/models/query.py", line 164, in
 __iter__
     self._fetch_all()
   File "/home/gfjom/django-virtualenv/lib/python2.7/site-
 packages/Django-1.8-py2.7.egg/django/db/models/query.py", line 999, in
 _fetch_all
     self._result_cache = list(self.iterator())
   File "/home/gfjom/django-virtualenv/lib/python2.7/site-
 packages/Django-1.8-py2.7.egg/django/db/models/query.py", line 292, in
 iterator
     for row in compiler.results_iter():
   File "/home/gfjom/django-virtualenv/lib/python2.7/site-
 packages/Django-1.8-py2.7.egg/django/db/models/sql/compiler.py", line 753,
 in results_iter
     row = self.apply_converters(row, converters)
   File "/home/gfjom/django-virtualenv/lib/python2.7/site-
 packages/Django-1.8-py2.7.egg/django/db/models/sql/compiler.py", line 696,
 in apply_converters
     value = converter(value, field)
   File "/home/gfjom/django-virtualenv/lib/python2.7/site-
 packages/Django-1.8-py2.7.egg/django/db/backends/oracle/base.py", line
 326, in convert_uuidfield_value
     value = uuid.UUID(value)
   File "/tools/general/app/python-2.7.5-rhel6/lib/python2.7/uuid.py", line
 134, in __init__
     raise ValueError('badly formed hexadecimal UUID string')
 ValueError: badly formed hexadecimal UUID string
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24012>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/056.40bc7855c212b7e6e05aaaa4fe971053%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to