Scott Marlowe <smarlowe@g2switchworks.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