Re: ORDER BY and NULLs - Mailing list pgsql-sql

From Murphy Pope
Subject Re: ORDER BY and NULLs
Date
Msg-id ot9gd.432$j15.304@fe25.usenetserver.com
Whole thread Raw
In response to Re: ORDER BY and NULLs  (<terry@ashtonwoodshomes.com>)
List pgsql-sql
>> I just dug out the PostgreSQL book again because I thought I might've
>> garbled it:
>> 
>> Quote: "PostgreSQL will not index NULL values. Because an index will
>> never include NULL values, it cannot be used to satisfy the ORDER BY
>> clause of a query that returns all rows in a table."
> 
> You should just cross out that whole section. It's just flatly wrong.
> 
> I had always assumed it was just people bringing assumptions over from
> Oracle where it is true. Perhaps this book is to blame for some of the
> confusion. Which book is it?
> 
> Postgres indexes NULLs. It can use them for ORDER BY clauses.

Now I'm confused...  here's a quote from Bruce Momjian from Oct. 2003:

> To be specific, we do not do index NULL values in a column, but we
> easily index non-null values in the column.

And a comment from backend/access/gist/gist.c (appears a few times):

> GiST cannot index tuples with leading NULLs

So what's the story?  Do GiST indexes index NULLs? Do other index types
index NULLs? Is the comment wrong or am I misreading it?







pgsql-sql by date:

Previous
From: "Jon Uhal"
Date:
Subject: Foreign Key Non-Null Problem in 8.0
Next
From: Murphy Pope
Date:
Subject: Re: ORDER BY and NULLs