#24767: Add GREATEST and LEAST Query Expressions
-------------------------------------+-------------------------------------
Reporter: Ian-Foote | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by jarshwah):
* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* needs_tests: => 0
* needs_docs: => 0
Comment:
This is appropriate for core.
Oracle supports GREATEST and LEAST, any null results in null.
Sqlite has MAX(a, b, ..) and MIN(a, b, ..), any null results in null.
Mysql has GREATEST and LEAST, any null results in null if version >=
5.0.13 (django only supports >= 5.5 so no need to support both
behaviours).
I'm not certain how we should handle nulls. Should we allow backend
specific behaviour (probably not, historically) or try to decide which way
is "better" for Django.
As a rough idea we could require a "if_null=" kwarg that would produce
GREATEST( [COALESCE(arg, if_null) for args..] ).That'd produce the same
value on all backends, I think, at the cost of extraneous sql. There
should be an opt-out to get backend specific behaviour though.
--
Ticket URL: <https://code.djangoproject.com/ticket/24767#comment:1>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.2998fc42fb30755470c0a37ae49f1b76%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.