Re: any way for ORDER BY x to imply NULLS FIRST in 8.3?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Reece Hart <reece(at)harts(dot)net>
Cc: rihad <rihad(at)mail(dot)ru>, pgsql-general(at)postgresql(dot)org
Subject: Re: any way for ORDER BY x to imply NULLS FIRST in 8.3?
Date: 2007-11-07 05:47:36
Message-ID: 8180.1194414456@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Reece Hart <reece(at)harts(dot)net> writes:
> However, it's not clear that you've considered a clause like 'ORDER BY
> (foo IS NULL), foo', which I believe is not implementation dependent.

Yeah, that should work reasonably portably ... where "portable" means
"equally lousy performance in every implementation", unfortunately :-(.
I rather doubt that many implementations will see through that to decide
that they can avoid an explicit sort.

> (In SQL2003 draft, true is defined to sort before false. I can't find a
> similar statement in SQL92 or SQL99.)

SQL92 doesn't actually acknowledge boolean as a data type, so it's not
gonna say that; but SQL99 does, and it has

The value true_ is greater than the value false_

under 4.6.1 Comparison and assignment of booleans

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Reg Me Please 2007-11-07 06:29:22 Re: returning dynamic record
Previous Message Tom Lane 2007-11-07 05:35:55 Re: returning dynamic record