Re: Nulls in timestamps

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
Cc: markMLl(dot)pgsql-general(at)telemetry(dot)co(dot)uk, pgsql-general(at)postgresql(dot)org
Subject: Re: Nulls in timestamps
Date: 2005-07-13 18:25:35
Message-ID: 20422.1121279135@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Scott Marlowe <smarlowe(at)g2switchworks(dot)com> writes:
> On Wed, 2005-07-13 at 12:41, Tom Lane wrote:
>> 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.

> Isn't this behaviour implementation dependent, i.e. other database could
> do it anyway they wanted? Just thinking of portability issues one might
> have if one were to rely on null sort order in an application.

According to the SQL spec it's "implementation defined", which means
different DBs could do it differently but they have to tell you what
they will do. "Implementation dependent" effectively means "the
behavior is not specified at all".

For instance, in SQL92 13.1 <declare cursor> general rule 3(b):

Whether a sort key value that is null is considered greater
or less than a non-null value is implementation-defined, but
all sort key values that are null shall either be considered
greater than all non-null values or be considered less than
all non-null values.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Doug Hall 2005-07-13 18:26:28 Re: Slow delete
Previous Message Scott Marlowe 2005-07-13 18:15:58 Re: Nulls in timestamps