Many thanks Tom. Inconvenient from the point of view of the application but still useful information. The situation is that I've got a query with numerous subselects, each of which has to return exactly one row so I was doing a union with a nulled record then selecting the most recent: obviously I need to see bona-fide data if it's there. What I'll do is teach the app or the users to ignore a specified early data, e.g. 1970-01-01. Again, many thanks (and boy, is it good to have that gateway working properly :-) Tom Lane wrote: > > markMLl.pgsql-general@xxxxxxxxxxxxxxx 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 > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings