Re: [HACKERS] More on 6.4 on DEC Alpha + Digital Unix 4.0d + DEC C compiler - Mailing list pgsql-hackers

From Pedro J. Lobo
Subject Re: [HACKERS] More on 6.4 on DEC Alpha + Digital Unix 4.0d + DEC C compiler
Date
Msg-id Pine.OSF.4.05.9811191112530.24390-100000@haddock.euitt.upm.es
Whole thread Raw
In response to Re: [HACKERS] More on 6.4 on DEC Alpha + Digital Unix 4.0d + DEC C compiler  (Oleg Broytmann <phd@sun.med.ru>)
Responses Re: [HACKERS] More on 6.4 on DEC Alpha + Digital Unix 4.0d + DEC C compiler
List pgsql-hackers
On Thu, 19 Nov 1998, Oleg Broytmann wrote:

>Hi!
>
>On Thu, 19 Nov 1998, Thomas G. Lockhart wrote:
>> > 2) The tests for char, varchar, select_implicit, select_having and 
>> > rules fail when locale is enabled, and pass when locale is disabled. 
>> > This is due to character comparisons being case insensitive when 
>> > locale is enabled. I don't think this is the correct behaviour. I'd 
>> > appreciate any hint on where to look to investigate this further.
>> 
>> src/backend/utils/adt/varlena.c
>
>   "character comparisons being case insensitive"? It is a problem in your
>locale, not in the comparison code (I hope). There is no such thing as
>"case-insensitive strcoll", and I just used strcoll in varlena.c.
>   The same problem popped up many times among linux users. Just install
>correct locale - and all will run well. There are test programs in
>src/test/locale, look carefully. If you can - supply test data for your
>locale.

Well, after a bit of investigation, now I know where the problem is. When
you do a case sensitive comparison, 'A' is considered "smaller" than 'a'.
Except, of course, if you use Digital's strcoll() (agh!). The comparison
when locale is enabled isn't case insensitive. Simply, the "sensitivity"
is inverted: 'A' is considered *greater* than 'a' (but not equal, as I
first thought). When you use the 'C' locale (that is, no locale), then the
output of strcmp() and strcoll() is the same.

So, this is indeed a Digital Unix problem. I've made the same tests under
FreeBSD, and they work as expected on it.

The next question is what to do now. I will send a message to Digital so
they can fix this bug in future releases, but what do I do in the
meantime? The problem is not dangerous except if you rely on upper-case
letters being ordered before lower-case. I could make a custom "expected"
output so that the regression tests do not fail, or we could simply write
a "README.DigitalUnix" telling the story. Writing a custom strcoll() seems
a bit overkill. What do you think?

>(It looks like my messages to pgsql-*@postgresql.org are usually dropped to
>floor. If anyone see it - please confirm, send to: phd2@earthling.net. I
>have no problems receiving mail from these lists, neither sending to many
>other lists I am on).

Your message made it to the list (I received it two times, one from you
and other from the list).

-------------------------------------------------------------------
Pedro José Lobo Perea                   Tel:    +34 91 336 78 19
Centro de Cálculo                       Fax:    +34 91 331 92 29
EUIT Telecomunicación - UPM             e-mail: pjlobo@euitt.upm.es



pgsql-hackers by date:

Previous
From: Oleg Broytmann
Date:
Subject: Re: [HACKERS] More on 6.4 on DEC Alpha + Digital Unix 4.0d + DEC C compiler
Next
From: Oleg Broytmann
Date:
Subject: Re: [HACKERS] More on 6.4 on DEC Alpha + Digital Unix 4.0d + DEC C compiler