* cc: contact@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/13312#comment:8>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: serhiy.int@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/13312#comment:9>
Comment (by int-ua):
AFAIU, it's possible in all main supported engines:
ORDER BY IF(ISNULL(my_field),1,0),my_field
[http://forums.mysql.com/read.php?10,208709,208927 in MySQL]
[NULLS { FIRST | LAST }] [http://www.postgresql.org/docs/8.3/static
/queries-order.html in both PostgreSQL]
[http://stackoverflow.com/questions/18698311/oracle-order-null-last-by-
default and Oracle]
ORDER BY col1 IS NULL [http://stackoverflow.com/questions/12503120/how-to-
do-nulls-last-in-sqlite in SqLite3]
--
Ticket URL: <https://code.djangoproject.com/ticket/13312#comment:10>
* cc: markus.magnuson@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/13312#comment:11>
* cc: josh.smeaton@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/13312#comment:12>
* cc: github@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/13312#comment:13>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/6981 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/13312#comment:14>
* needs_better_patch: 0 => 1
Comment:
Comments for improvement are on the PR. Please uncheck "Patch needs
improvement" after you update it an add documentation (see our
PatchReviewChecklist).
--
Ticket URL: <https://code.djangoproject.com/ticket/13312#comment:15>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/13312#comment:16>
* needs_docs: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/13312#comment:17>
* needs_docs: 1 => 0
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/13312#comment:18>
* needs_better_patch: 1 => 0
Comment:
[https://github.com/django/django/pull/7563 Updated PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/13312#comment:19>
* status: new => assigned
* owner: nobody => felixxm
--
Ticket URL: <https://code.djangoproject.com/ticket/13312#comment:20>
* stage: Accepted => Ready for checkin
Comment:
Looking good pending some cosmetic changes.
--
Ticket URL: <https://code.djangoproject.com/ticket/13312#comment:21>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"47ef8f31f30a2b1920f82494d729c285565867dd" 47ef8f3]:
{{{
#!CommitTicketReference repository=""
revision="47ef8f31f30a2b1920f82494d729c285565867dd"
Fixed #13312 -- Allowed specifying the order of null fields in queries.
Thanks Mariusz Felisiak for finishing the patch.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/13312#comment:22>
Comment (by Cloudream):
What about one parameter with three possible values?
nulls_first:
- True: nulls at first
- False: nulls at last
- None (default): database default ordering
--
Ticket URL: <https://code.djangoproject.com/ticket/13312#comment:23>
Comment (by Josh Smeaton):
I don't like the idea of three-value logic here, because it imposes a
slight burden when reading. It just seems unnecessary when there's nothing
wrong with two kwarg options.
--
Ticket URL: <https://code.djangoproject.com/ticket/13312#comment:24>
Comment (by Simon Charette):
@Cloudream see the discussion on the original
[https://github.com/django/django/pull/6981 PR] about why `nulls_first`
and `nulls_last` were chosen.
--
Ticket URL: <https://code.djangoproject.com/ticket/13312#comment:25>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"a699595fce27d5d9c45ba83c656319593c366be9" a699595f]:
{{{
#!CommitTicketReference repository=""
revision="a699595fce27d5d9c45ba83c656319593c366be9"
Refs #13312 -- Removed unnecessary IF wrapping in nulls_last handling on
MySQL.
ISNULL function already returns 0 and 1 on MySQL.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/13312#comment:26>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"7286eaf681d497167cd7dc8b70ceebfcf5cd21ad" 7286eaf]:
{{{
#!CommitTicketReference repository=""
revision="7286eaf681d497167cd7dc8b70ceebfcf5cd21ad"
Refs #13312 -- Simplified handling of nulls ordering on MySQL.
MySQL & MariaDB support the standard IS NULL and IS NOT NULL so
the same workaround used for NULLS FIRST and NULLS LAST that is
used for SQLite < 3.30.0 can be used.
Thanks Simon Charette for the discussion.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/13312#comment:27>