Re: [v9.2] make_greater_string() does not return a string in some cases - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [v9.2] make_greater_string() does not return a string in some cases
Date
Msg-id 5358.1317046134@sss.pgh.pa.us
Whole thread Raw
In response to Re: [v9.2] make_greater_string() does not return a string in some cases  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: [v9.2] make_greater_string() does not return a string in some cases
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> On fre, 2011-09-23 at 20:35 +0300, Marcin Mańk wrote:
>> One idea:
>> col like 'foo%' could be translated to col >= 'foo' and col <= foo || 'zzz' , where 'z' is the largest possible
character.This should be good enough  for calculating stats.
 
>> How to find such a character, i do not know.

> That's what makes this so difficult.

> If we knew the largest character, we could probably also find the
> largest-1, largest-2, etc. characters and determine the total order of
> everything.

No, it's a hundred times worse than that, because in collations other
than C there typically *is* no total order.  The collation behavior of
many characters is context-sensitive, thanks to the multi-pass behavior
of typical "dictionary" algorithms.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: contrib/sepgsql regression tests are a no-go
Next
From: Robert Haas
Date:
Subject: Re: contrib/sepgsql regression tests are a no-go