Re: [HACKERS] NULLs and sort order

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] NULLs and sort order
Дата
Msg-id 16765.1000617143@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: NULLs and sort order  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-jdbc
Peter Eisentraut <peter_e@gmx.net> writes:
> Rene Pijlman writes:
>> Currently the JDBC driver says:
>> - Backend >= 7.2 sorts nulls higher than any other value in a
>> domain. In other words: ascending means nulls at the end,
>> descending means nulls at the start.
>> - Backend < 7.2 puts nulls at the end regardless of sort order.

> That is correct.

Actually it's more complex than that.  7.2 will provide the above-stated
consistent ordering of nulls relative to non-nulls.  The problem with
earlier versions is that the ordering of nulls depends on what plan the
optimizer chooses for the query: sorting based on a scan of a btree
index would work the same as is described for 7.2, whereas sorting
based on an explicit sort step would put the nulls at the end (for
either ASC or DESC sort).  So there was *no* consistent behavior at all
in prior versions.  The fix that's been applied for 7.2 is to make
explicit sorts act the same as indexscans already did.

            regards, tom lane

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Rene Pijlman
Дата:
Сообщение: Re: isNullable()
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: UpdateableResultSet patch (not finished yet!)