[Python-Dev] python 3 niggle: None < 1 raises TypeError

Chris Angelico rosuav at gmail.com
Fri Feb 14 11:34:08 CET 2014


On Fri, Feb 14, 2014 at 9:20 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> Hmm, it seems you're right, but I'm quite sure some DBMSes have a
> consistent way of ordering NULLs when using ORDER BY on a nullable
> column.

Yes, and I believe it's part of the SQL-92 spec. Certainly here's
PostgreSQL's take on the matter:

http://www.postgresql.org/docs/9.3/static/sql-select.html#SQL-ORDERBY

In short, NULL is by default considered greater than anything else
(last in an ascending sort, first in a descending sort), but this can
be inverted. Oddly enough, the syntax is NULLS FIRST vs NULLS LAST,
not NULLS LOW vs NULLS HIGH.

ChrisA


More information about the Python-Dev mailing list