Re: Nulls in timestamps - Mailing list pgsql-general

From markMLl.pgsql-general@telemetry.co.uk
Subject Re: Nulls in timestamps
Date
Msg-id 42D55A30.6E78564A@telemetry.co.uk
Whole thread Raw
In response to Nulls in timestamps  (markMLl.pgsql-general@telemetry.co.uk)
Responses Re: Nulls in timestamps
List pgsql-general
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@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
>
> ---------------------------(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]

pgsql-general by date:

Previous
From: Oleg Bartunov
Date:
Subject: Re: fts error
Next
From: Scott Marlowe
Date:
Subject: Re: Nulls in timestamps