At 21:24 +0200 2/16/03, Michael Widenius wrote:
>Hi!
>
>A very small update.
>
>>>>>> "Sergei" == Sergei Golubchik <serg@stripped> writes:
>
>Sergei> Hi!
>>> Sergei,
>>>
>>> Thanks, although I'm still wondering about why the NULL-always-sorts-first
>>> change was made for 4.0.2. Wasn't that done for ANSI compliance? Did
>>> the ANSI spec change?
>
><cut>
>
>Sergei> ANSI X3.135-1992 (Database Language SQL) in section 13.1, General
>Sergei> Rule 3)b), page 309, says "Whether a sort key value that is null is
>Sergei> considered greater or less than a non-null value is implementation-
>Sergei> defined, but all sort key values that are null shall either be
>Sergei> considered greater than all non-null values or be
>considered less than
>Sergei> all non-null values."
>
>The problem is that the above doesn't spell out how NULL is affected
>by DESC. As NULL can't be compared and are not ordered (by
>definition) it's not clear from the above (at least to me) what DESC
>is supposed to do.
It seems to have one of two possible meanings:
- NULL is less than non-null. The implication is that NULL will sort
first for ASC, and therefore last for DESC.
- NULL is greater than non-null. The implication is that NULL will sort
last for ASC, and therefore first for DESC.
>
>Anyway, as Sergei said, the current (changed) behaviour is probably
>what ANSI SQL means and is most like the way most other database is
>handling DESC with NULL. Sorry again for the confusion....
Okay. Please don't change NULL sorting again for at least 10 years. :-)
>
>Regards,
>Monty