From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Bruno Wolff III <bruno(at)wolff(dot)to> |
Cc: | Doug McNaught <doug(at)mcnaught(dot)org>, Ricardo Perez Lopez <ricpelo(at)hotmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: '1 year' = '360 days' ???? |
Date: | 2004-10-24 03:36:05 |
Message-ID: | 5047.1098588965@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Bruno Wolff III <bruno(at)wolff(dot)to> writes:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Anybody have any thoughts about a better way to map the multicomponent
>> reality into a one-dimensional sorting order?
> You could return NULL for cases where the number of months in the
> first interval is less than the second, but the number of seconds in
> the second interval is greater than the first.
No, you can't, at least not if you want to have btree indexes on
interval columns. The comparison operators can never return NULL
for nonnull inputs.
> If you want to be able to use a btree index, you need a total ordering, so
> in that case I think you have to have things work pretty much the way they do
> now, including the way the equality operator works.
We don't have to have this particular sorting decision, we just have
to have *some* unique sorting order. In particular, if we want to say
that two interval values are not equal, we have to be able to say which
one is less. For instance, "compare the months first and only if equal
compare the seconds" would work fine from the point of view of btree.
It's just that that leads to a sort order that users will probably not
like very much.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Bruno Wolff III | 2004-10-24 04:15:57 | Re: '1 year' = '360 days' ???? |
Previous Message | Bruno Wolff III | 2004-10-24 02:29:08 | Re: '1 year' = '360 days' ???? |