Re: Nulls in timestamps

From: markMLl(dot)pgsql-general(at)telemetry(dot)co(dot)uk
To: pgsql-general(at)PostgreSQL(dot)org
Subject: Re: Nulls in timestamps
Date: 2005-07-13 18:15:12
Message-ID: 42D55A30.6E78564A@telemetry.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)pgsql-general(at)telemetry(dot)co(dot)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]

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2005-07-13 18:15:58 Re: Nulls in timestamps
Previous Message Oleg Bartunov 2005-07-13 18:14:05 Re: fts error