Changes between Initial Version and Version 1 of Ticket #32577, comment 16
- Timestamp:
- Apr 6, 2022, 4:19:06 AM (3 years ago)
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.1 In 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. 2 2 3 3 DEFAULT_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. … … 7 7 AutoField in Django that can be DEFAULT_AUTO_FIELD uses db sequence that gives 100% unique values. 8 8 9 https://franckpachot.medium.com/uuid-aka-guid-vs-oracle-sequence-number-ab11aa7dbfe7 10 https://asktom.oracle.com/pls/apex/f?p=100:11:0::::p11_question_id:2570145300346198113 11 9 12 If 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**. 10 13 11 14 But, 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. 15 See 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"