Code

Opened 3 years ago

Last modified 11 months ago

#17337 new Bug

[nonrel] Support for non-integer automatic primary keys

Reported by: jonash Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords: nonrel
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

(This patch is part of the changes made to the inofficial fork "Django-nonrel" which adds basic support for non-relational databases.)

This patch adds basic support for non-integer primary keys. It works by not restricting primary keys to int and factoring out pk validation/type conversion into the backend.

Attachments (1)

nonint-autoid.patch (3.7 KB) - added by jonash 3 years ago.

Download all attachments as: .zip

Change History (7)

Changed 3 years ago by jonash

comment:1 Changed 3 years ago by carljm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Accepting the ticket, as support for non-integer auto-fields is certainly desirable. I believe there's a different implementation of it in Alex Gaynor's 2010 GSoC code - I don't know which implementation is preferable.

comment:2 Changed 3 years ago by russellm

IIRC, Alex's GSoC code punted on this issue (or, at least, had code that wasn't suitable for trunk), because we couldn't come up with a way to introduce it without introducing backwards incompatibilities. I seem to recall there were a bunch of places in the code that assumed that AutoFields were integers; however, it's been a while, so I might be mis-remembering.

comment:3 Changed 3 years ago by jonash

A few contrib apps assume PKs to be integers and also it gets tricky when it comes to testing with fixtures. Should we address all these issues at once or fix them bit by bit in multiple tickets?

comment:4 Changed 3 years ago by aaugustin

  • Type changed from Uncategorized to Bug

Two tickets (#17214, #17122) were recently reported about problems in the admin with models using non-integer primary keys. A quick search for "primary_key" turns up lots of other problems with non-integer primary keys. Clearly people are trying to use them, and as far as I can see, the docs don't forbid it.

Version 0, edited 3 years ago by aaugustin (next)

comment:5 Changed 3 years ago by aaugustin

  • Summary changed from [nonrel] Support for non-integer primary keys to [nonrel] Support for non-integer automatic primary keys

comment:6 Changed 11 months ago by timo

  • Patch needs improvement set

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as new
The owner will be changed from nobody to anonymous. Next status will be 'assigned'
as The resolution will be set. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.