#24012: models.UUIDfield fails on Oracle backend
-------------------------------------+-------------------------------------
Reporter: JorisBenschop | Owner: nobody
Type: Uncategorized | Status: new
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage:
Keywords: oracle, | Unreviewed
models.UUIDfield | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Comment (by timgraham):
I'd suggest trying to run Django's test suite on Oracle. You'll see errors
in the test like this with that change:
{{{
======================================================================
ERROR: test_uuid_instance (model_fields.test_uuid.TestSaveLoad)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/tim/code/django/tests/model_fields/test_uuid.py", line 14,
in test_uuid_instance
loaded = UUIDModel.objects.get()
File "/home/tim/code/django/django/db/models/manager.py", line 82, in
manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/tim/code/django/django/db/models/query.py", line 367, in get
num = len(clone)
File "/home/tim/code/django/django/db/models/query.py", line 144, in
__len__
self._fetch_all()
File "/home/tim/code/django/django/db/models/query.py", line 996, in
_fetch_all
self._result_cache = list(self.iterator())
File "/home/tim/code/django/django/db/models/query.py", line 289, in
iterator
for row in compiler.results_iter():
File "/home/tim/code/django/django/db/models/sql/compiler.py", line 757,
in results_iter
row = self.apply_converters(row, converters)
File "/home/tim/code/django/django/db/models/sql/compiler.py", line 700,
in apply_converters
value = converter(value, field)
File "/home/tim/code/django/django/db/backends/oracle/base.py", line
333, in convert_uuidfield_value
value = uuid.UUID(bytes=value)
File "/usr/lib/python2.7/uuid.py", line 144, in __init__
raise ValueError('bytes is not a 16-char string')
ValueError: bytes is not a 16-char string
}}}
Django creates `UUIDField` as a `VARCHAR2(32)` in Oracle as shown by the
code I linked in comment 3.
Also Django's field generates UUIDs in Python whereas your field uses the
database to generate them. See ticket:19463#comment:15 for the background.
--
Ticket URL: <https://code.djangoproject.com/ticket/24012#comment:8>
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/071.f95567523023ddeed206a2d32398c673%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.