Changes between Initial Version and Version 1 of Ticket #32577, comment 16


Ignore:
Timestamp:
04/06/22 09:19:06 (10 months ago)
Author:
raydeal
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #32577, comment 16

    initial v1  
    1 In my opinion allowing users to use uuid as DEFAULT_AUTO_FIELD isn't good unless top db providers (Oracle, MS SQL, Postgres, SQLite) will support it in db as a kind of sequence and they will introduce uuid as auto primary key type.
     1In my opinion allowing users to use uuid as DEFAULT_AUTO_FIELD isn't good unless top db providers (Oracle, MS SQL, IBM, Postgres, SQLite) will support it in db as a kind of sequence and they will introduce uuid as auto primary key type.
    22
    33DEFAULT_AUTO_FIELD is dedicated to create id field in every model. I can imagine some situation where UUID is better than INT as Primary Key, but in most cases it isn't. If it was, the top db providers would implement it a long time ago.
     
    77AutoField in Django that can be DEFAULT_AUTO_FIELD uses db sequence that gives 100% unique values.
    88
     9https://franckpachot.medium.com/uuid-aka-guid-vs-oracle-sequence-number-ab11aa7dbfe7
     10https://asktom.oracle.com/pls/apex/f?p=100:11:0::::p11_question_id:2570145300346198113
     11
    912If UUIDAutoField is created in Django based on @Nick Pope proposal (RandomUUID), it will be worth to add in documentation that **it doesn't qurantee that value is unique**.
    1013
    1114But, definitely, it is worth to allow users to create a custom AutoField based on any other field type (as reported in #17337), maybe except Text/Boolean types, and use it as PK. Anyone can then create their own UUIDAutoField and take responsibility for uniques.
     15See last comment [https://asktom.oracle.com/pls/apex/asktom.search?tag=oracle-sequence-vs-guid here]
     16"So yes, having a sequence PK (that stays hidden) and a GUID UK (that customers see) can be a good option"
Back to Top