#31487: Add support for precision argument to Round
-------------------------------------+-------------------------------------
     Reporter:  Baptiste Mispelon    |                    Owner:  Nick Pope
         Type:  New feature          |                   Status:  assigned
    Component:  Database layer       |                  Version:  dev
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  database function,   |             Triage Stage:  Accepted
  round, precision, decimal places   |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Nick Pope):

 * keywords:   => database function, round, precision, decimal places
 * owner:  (none) => Nick Pope
 * has_patch:  0 => 1
 * version:  3.0 => dev
 * status:  new => assigned


Comment:

 For once, I can't remember exactly why we didn't do this, hence my opening
 of the duplicate ticket #32592 yesterday looking to fix exactly this
 issue.

 I can think of a number of possible reasons based on the discussions and
 looking at the existing code:

 - Something to do with the rounding issue around `0.5`. ''(I don't think
 this should stop us supporting the second argument. We already mention it
 in the [https://docs.djangoproject.com/en/3.1/ref/models/database-
 functions/#round documentation].)''
 - Something to do with `Round` being a `Transform` which sets `arity = 1`.
 ''(This can be overridden back to `None` while still allowing the
 transform to work.)''
 - Something to do with SpatiaLite. I'm not sure what that comment was
 about as SQLite and SpatialLite behave the same and the function is
 available in SQLite.
 - The SQLite version of `ROUND()` does not support negative precision
 values.

 Anyway, here is a [https://github.com/django/django/pull/14182 PR].

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31487#comment:7>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.8100ed614db549c3ae21151fc443638c%40djangoproject.com.

Reply via email to