#24012: models.UUIDfield fails on Oracle backend
-------------------------------------+-------------------------------------
Reporter: JorisBenschop | Owner: nobody
Type: Uncategorized | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: wontfix
Keywords: oracle, | Triage Stage: Accepted
models.UUIDfield,1.8-alpha |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by shaib):
* cc: shaib (added)
* status: new => closed
* resolution: => wontfix
Comment:
Oracle's `SYS_GUID` generates globally-unique identifiers, but not
RFC4122-compliant UUIDs. Added to Tim's comment:8 note that our
`UUIDField` generates UUIDs in Python (where `SYS_GUID` is a database
function), I am quite reluctant to make `UUIDField` compatible with
`SYS_GUID` on Oracle.
A `SYSGUIDField` along the lines suggested sounds like a good idea --
except that I see no reason for it to be added to core. It can live
happily as a 3rd-party component, at least until proven otherwise. Thus, I
am closing this as "won't fix", but (anyone) feel free to reopen if you
have new arguments for it.
With respect to the specific code you've written, I have two comments:
1. I think if you inherited from `BinaryField`, rather than `Field`, you
could drop all the type-conversion code. At a first glance, it seems the
only feature of `BinaryField` you need to change is the underlying field
type (it uses BLOB).
2. I presume that you need the `new_sys_guid()` function in order to set
the default on fields you use. I think that is suboptimal -- it requires a
separate database round-trip. You should be able to change the field type
to something like `RAW(16) DEFAULT SYS_GUID()`, and set a flag on it to
make your field behave like `AutoField` -- have the value filled in only
when inserted to the DB, and returned to the object by the insertion
operation. If you find you need any changes in core to make that work,
they would be considered favorably.
HTH, Shai.
--
Ticket URL: <https://code.djangoproject.com/ticket/24012#comment:13>
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.1839c862c631b32334434543d2ab2c74%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.