Re: Nulls in timestamps - Mailing list pgsql-general

From Tom Lane
Subject Re: Nulls in timestamps
Date
Msg-id 14088.1121276504@sss.pgh.pa.us
Whole thread Raw
In response to Nulls in timestamps  (markMLl.pgsql-general@telemetry.co.uk)
Responses Re: Nulls in timestamps  (Scott Marlowe <smarlowe@g2switchworks.com>)
List pgsql-general
markMLl.pgsql-general@telemetry.co.uk writes:
> Where does PostgreSQL rank nulls when sorting a column of timestamps, is this
> behaviour deterministic, and can I rely on it not changing in the future?

Nulls sort high (in any datatype, not only timestamps).  It's possible
that we'd offer an option to make them sort low in the future, but I
can't imagine that we'd change the default behavior.

regression=# (select 1 as x union select null) order by x;
 x
---
 1

(2 rows)

regression=# (select 1 as x union select null) order by x desc;
 x
---

 1
(2 rows)

regression=#

            regards, tom lane

pgsql-general by date:

Previous
From: TJ O'Donnell
Date:
Subject: Re: [SQL] dynamically loaded functions
Next
From: Tom Lane
Date:
Subject: Re: Slow delete