Opened 2 years ago

Last modified 8 months ago

#24920 new New feature

Database type NUMERIC with no parameters is not supported

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

Description

Django's DecimalField requires both max_digits and decimal_places. Database backends allow them to be dropped, to specify an "unlimited precision" field.

This leads to bugs in inspectdb: On Oracle, a column defined as NUMERIC is inspected as having 0 digits and negative precision; on Postgresql, it is inspected as having 65535 (a C short -1?) digits and decimal places, when the documentation says you can only explicitly define up to 1000 decimal places (and even the implicitly defined precision is only 16383).

Discussion in the context of Oracle (from 2012):
https://groups.google.com/d/topic/django-developers/qSAfzPyqKqw/discussion

(This could be solved more easily by adding a new field type than by modifying the behavior of the existing DecimalField; however, I'm having a hard time suggesting a name for such a field type, which may be an indication that it is a bad interface. Besides that decision, this probably applies as an easy picking).

Change History (3)

comment:1 Changed 2 years ago by Tim Graham

Easy pickings: unset
Needs documentation: unset
Needs tests: unset
Triage Stage: UnreviewedAccepted

Maybe you could raise the idea on the DevelopersMailingList. I think I'd prefer if we didn't need to add a new field, but if so, I'll propose the name ImpreciseDecimalField. Seems like a name like that might scare people away from using it though.

comment:2 Changed 8 months ago by Maciej Gol

Any update on this or a suggested way of resolving: either new field or a fix to DecimalField?

comment:3 Changed 8 months ago by Tim Graham

If you want to propose a solution, please write to the DevelopersMailingList to get feedback about how to proceed.

Note: See TracTickets for help on using tickets.
Back to Top