Re: Range types - Mailing list pgsql-hackers

From Florian G. Pflug
Subject Re: Range types
Date
Msg-id 4B27AB81.8090505@phlo.org
Whole thread Raw
In response to Re: Range types  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 15.12.09 15:52 , Tom Lane wrote:
> tomas@tuxteam.de writes:
>> (and as Andrew Dunstan pointed out off-list: I was wrong with my
>> bold assertion that one can squeeze infinitely many (arbitrary
>> length) strings between two given. This is not always the case).
>
> Really?  If the string length is unbounded I think you were right.

One example is "a" and "aa" (assuming "a" is minimal character in your
alphabet). The general case is the strings A and Aaaaaaa...a I think -
it doesn't get any more exciting than this.

This *is* a bit surprising, since one usually assumes that the ordering
of strings and reals is fairly similar, since both are lexical.

But note that the mapping of strings into the reals this intuition is
based on (simply prefix a the string with "0." and interpret as a real,
or something similar if the alphabet isn't {0,1}) isn't one-to-one - the
strings "1", "10", "100", ... are all mapped to the *same* real number 0.1

So for reals, the statement is reduced to the trivial fact that for
every x there is no y with x < y < x. Which is of course true..

best regards,
Florian Pflug


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Range types
Next
From: Tom Lane
Date:
Subject: Re: Range types