Обсуждение: Sort bug

Поиск
Список
Период
Сортировка

Sort bug

От
okijhhyu
Дата:
Good morning, dear friends. 

In sorting by DESC null in up and ASC ‘’ in up, why them not near?

Respectfully yours, okijhhyu

Re: Sort bug

От
Daniel Gustafsson
Дата:
> On 14 Dec 2022, at 08:20, okijhhyu <okijhhyu@gmail.com> wrote:

> In sorting by DESC null in up and ASC ‘’ in up, why them not near?

I'm not sure I understand, can you show a small query which exhibits the
behavior you believe is buggy and explain what you think should've happened?

--
Daniel Gustafsson        https://vmware.com/




Re: Sort bug

От
Pavel Borisov
Дата:
> Good morning, dear friends.
>
> In sorting by DESC null in up and ASC ‘’ in up, why them not near?
>
> Respectfully yours, okijhhyu
NULLS are not empty values but undefined values. Nevertheless, in
PostgreSQL there is the following default order for their sorting: "By
default, null values sort as if larger than any non-null value; that
is, NULLS FIRST is the default for DESC order, and NULLS LAST
otherwise." (https://www.postgresql.org/docs/current/queries-order.html).

Nulls ordering can be changed by. The NULLS FIRST and NULLS LAST
options can be used to determine whether nulls appear before or after
non-null values in the sort ordering.

Do you see this or something contrary to?

Best regards,
Pavel Borisov,
Supabase