Re: [Django] #13312: order_by on null-field gives different results on different db engines

2016-02-18 Thread Django
#13312: order_by on null-field gives different results on different db engines
-+-
 Reporter:  binary   |Owner:  nobody
 Type:  Uncategorized|   Status:  new
Component:  Database layer   |  Version:  1.1
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ordering, order_by,  | Triage Stage:
  null   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by jarshwah):

 * status:  closed => new
 * resolution:  wontfix =>


Comment:

 Now that we have expressions, I think it's fine to reopen this ticket. We
 can introduce a `OrderNulls.last()/.first()` expression to handle this in
 a standard way. We could also just build it right into the `OrderBy`
 expression:

 {{{
 qs.order_by(F('my_field').asc().nullslast())
 }}}

 If we do build this into the existing order_by, you'll need to be careful
 about preserving a 'feature' that stops django from inserting duplicate
 ordering clauses (it builds each component then does a string compare to
 ensure the new clause isn't a duplicate).

 This won't normalise order by nulls across backends, but it'll allow users
 to control null handling semantics if they have a use for it. NULL
 handling was originally going to be added to the OrderBy expression, but I
 ran out of time before that could happen.

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.505cb8a853ae5d932ad05feee764810c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #13312: order_by on null-field gives different results on different db engines

2016-02-18 Thread Django
#13312: order_by on null-field gives different results on different db engines
-+-
 Reporter:  binary   |Owner:  nobody
 Type:  Uncategorized|   Status:  closed
Component:  Database layer   |  Version:  1.1
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  ordering, order_by,  | Triage Stage:
  null   |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by blueyed):

 * ui_ux:   => 0
 * type:   => Uncategorized
 * severity:   => Normal
 * easy:   => 0


Comment:

 See http://stackoverflow.com/a/35494930/15690, which uses a specilaized
 QuerySet/Query.

 The ``extra()`` approach is deprecated, and won't work with foreign keys /
 joined tables.

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.6019287ac1418c64e1ef6e34eb7690fb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #13312: order_by on null-field gives different results on different db engines

2011-01-27 Thread Django
#13312: order_by on null-field gives different results on different db engines
---+
  Reporter:  binary| Owner:  nobody 
 
Status:  closed| Milestone: 
 
 Component:  Database layer (models, ORM)  |   Version:  1.1
 
Resolution:  wontfix   |  Keywords:  ordering, 
order_by, null
 Stage:  Unreviewed| Has_patch:  0  
 
Needs_docs:  0 |   Needs_tests:  0  
 
Needs_better_patch:  0 |  
---+
Comment (by daonb):

 thanks chexum

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #13312: order_by on null-field gives different results on different db engines

2010-11-20 Thread Django
#13312: order_by on null-field gives different results on different db engines
---+
  Reporter:  binary| Owner:  nobody 
 
Status:  closed| Milestone: 
 
 Component:  Database layer (models, ORM)  |   Version:  1.1
 
Resolution:  wontfix   |  Keywords:  ordering, 
order_by, null
 Stage:  Unreviewed| Has_patch:  0  
 
Needs_docs:  0 |   Needs_tests:  0  
 
Needs_better_patch:  0 |  
---+
Changes (by chexum):

  * keywords:  ordering, order_by => ordering, order_by, null

Comment:

 Just to document it, there is a very easy way to control this behavior.
 The most portable seems to be an additional order by for "field IS NULL".
 It puts NULLs last in at least sqlite3, mysql and PostgreSQL.  The reverse
 is either "field IS NULL DESC" or "field IS NOT NULL".

 It's also easy to use in a Django way:

 {{{
 q = q.extra(select={'null1':'field1 is null','null2':'field2 is
 null'})
 q = q.extra(order_by=['null1','-field1','-null2','field2'])
 }}}

 Because it's so easy to do in a standard way, it might be worth at some
 point to add a specific queryset for it (not necessarily modifying
 order_by()), as extra() is not always desirable.   Having a new queryset
 would allow backend specific optimization, like nulls last/first if
 supported.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #13312: order_by on null-field gives different results on different db engines

2010-04-12 Thread Django
#13312: order_by on null-field gives different results on different db engines
---+
  Reporter:  binary| Owner:  nobody 
   
Status:  closed| Milestone: 
   
 Component:  Database layer (models, ORM)  |   Version:  1.1
   
Resolution:  wontfix   |  Keywords:  ordering, 
order_by
 Stage:  Unreviewed| Has_patch:  0  
   
Needs_docs:  0 |   Needs_tests:  0  
   
Needs_better_patch:  0 |  
---+
Comment (by binary):

 that's ok, but there is no way to control this behavior. i mean that i
 can't tell pgsql that i want nulls to be less than others in any good way.
 :(

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #13312: order_by on null-field gives different results on different db engines

2010-04-09 Thread Django
#13312: order_by on null-field gives different results on different db engines
---+
  Reporter:  binary| Owner:  nobody 
   
Status:  closed| Milestone: 
   
 Component:  Database layer (models, ORM)  |   Version:  1.1
   
Resolution:  wontfix   |  Keywords:  ordering, 
order_by
 Stage:  Unreviewed| Has_patch:  0  
   
Needs_docs:  0 |   Needs_tests:  0  
   
Needs_better_patch:  0 |  
---+
Changes (by ubernostrum):

  * status:  new => closed
  * needs_better_patch:  => 0
  * resolution:  => wontfix
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 I think this is one of those cases where we really just have to tell
 people to know the behavior of the DB they choose to use; `NULL`-handling
 in all its many forms is one of those things that's just not worth the
 time and complexity of abstraction.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.