Re: [SQL] Howto to force NULL rows at the bottom ?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Stoyan Genov <genov(at)digsys(dot)bg>, Dirk Lutzebaeck <lutzeb(at)aeccom(dot)com>, pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] Howto to force NULL rows at the bottom ?
Date: 1999-12-06 13:37:04
Message-ID: 199912061337.IAA18651@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> After further thought I think the goal of making explicit sort order
> always match btree index results is unreachable, because the explicit
> sort hasn't got enough information. All it has is an operator ID, and
> that's about all it can possibly have, at least in the "USING operator"
> case. But btree ordering doesn't depend on an operator ID, it depends
> on an opclass. The counterexample goes like this: I could easily make
> two different opclasses, "int_forward" and "int_reverse", that both work
> on int4 data but produce opposite btree sort orders. They're even built
> from the same operators, just lined up differently. Now, how shall an
> explicit sort decide which btree ordering to conform to? Indeed, if
> I make two indexes on the same table using the two opclasses, it's not
> even predictable which ordering an index-driven sort will return.
>
> This counterexample is a bit farfetched of course, but it shows that
> there is no theoretically-pure answer. We have to make some unprovable
> assumptions about what to do.

But if we have an operator, shouldn't we just look for < and > and use
them if we have those symbols? Seems like it would be better than what
we have, if not perfect.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Mario Jorge Nunes Filipe 1999-12-06 13:49:38 Re: [SQL] Wierd stuff
Previous Message Frank Joerdens 1999-12-06 12:56:53 Re: [SQL] How to avoid "Out of memory" using aggregate functions?