| From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
|---|---|
| To: | Wei Weng <wweng(at)kencast(dot)com> |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: How do you compare (NULL) and (non-NULL)? |
| Date: | 2004-10-26 20:48:48 |
| Message-ID: | 20041026134508.N5021@megazone.bigpanda.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
On Tue, 26 Oct 2004, Wei Weng wrote:
> In the following query
>
> SELECT Parent FROM Channels ORDER BY Parent ASC;
>
> If I have a couple of (NULL)s in the field [Parent], they will be listed at
> the bottom of the query result.
>
> Is it because PostgreSQL considers (NULL) as the biggest value? If I run the
> same query under MSSQL Server 2000, I get the exact opposite result
> regarding the order of (NULL)s and (non-NULL) values. They are listed at the
> very beginning of the query result.
The spec basically says (IIRC) that implementations must either treat all
nulls as greater than all non-nulls for ordering or less than all
non-nulls for ordering, but that different implementations may choose
different choices. I think the most recent version (at least) provides an
option to specify which way to handle nulls, but we don't support that as
far as I know.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jerome Alet | 2004-10-26 21:01:29 | Re: How do you compare (NULL) and (non-NULL)? |
| Previous Message | Oliver Elphick | 2004-10-26 20:34:41 | Re: How to re-sort a sorted query? |