Re: [HACKERS] NULL field records handling in order clause
| От | Thomas G. Lockhart |
|---|---|
| Тема | Re: [HACKERS] NULL field records handling in order clause |
| Дата | |
| Msg-id | 4846958c24bc8ef72eebebcf615c240e обсуждение исходный текст |
| Ответ на | [HACKERS] NULL field records handling in order clause (Constantin Teodorescu <teo@flex.ro>) |
| Список | pgsql-hackers |
Constantin Teodorescu wrote:
> PostgreSQL 6.1 , Linux RedHat 4.2 Kernel 2.0.30
> Selecting all records and ordering ascending and descending on a field :
> template1=> select * from pers order by cod;
> template1=> select * from pers order by cod desc;
> ("cod" fields which are null _always_ show up at the end)
This is an interesting feature. The reason for this behavior is that
"null" fields should (I think) always return FALSE in comparisons, and
the order-by is done using "<" or ">" operators. Remember, "null" is
nothing, *not anything*, and hence is not comparable to anything which
is not null. Even two null values should compare FALSE, I think.
I believe that this is correct behavior. Is anyone aware of anything
goofy in some SQL standards which would have this behave differently??
- Tom
------------------------------
В списке pgsql-hackers по дате отправления: