From: | Goran Thyni <goran(at)kirra(dot)net> |
---|---|
To: | "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu> |
Cc: | PostgreSQL Hackers <hackers(at)postgreSQL(dot)org> |
Subject: | Re: [HACKERS] Patch (was: tough locale bug) |
Date: | 1999-02-01 16:38:52 |
Message-ID: | 36B5D89C.823C6E01@kirra.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
"Thomas G. Lockhart" wrote:
>
> > #ifdef USE_LOCALE
> > ! if ((int)arg2[len2 - 1] != -1)
>
> Sorry, I'm not as familiar with the LOCALE code as I should be. Why are
> we testing explicitly for -1? Is there something special about a
> character with all bits set in typical locale support code?
>
> Regards.
>
> - Tom
It looks a bit cryptic yes, but it is not specific to locale.
The planner appends a "(char) -1" (or alt syntax '\xFF') to
the teststring in some cases of "<=" on text (f.ex in "txt ~ '^G'").
This works OK with strncmp which compare char by char as unsigned ints,
but locale uses lookup-tables where '\FF' not is guanteed to be
greater or equal to any other unsigned 8-bit character.
Therefore I did a fallback to strncmp (instead of locale aware strcoll)
for this special case.
It is not the perfect solution and may break in a few cases, but as it
is now
it breaks most usage of LIKE and ~ when locale is enabled.
If we could in a portable way to find the last usable character in the
used charset it would be nice, but I have not found any way to do that.
regards,
--
---------------------------------------------
Göran Thyni, JMS Bildbasen, Kiruna
This is Penguin Country. On a quiet night you can hear Windows NT
reboot!
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Elphick | 1999-02-01 16:40:37 | Re: [SQL] Re: [HACKERS] Re: SELECT DISTINCT ON ... ORDER BY ... |
Previous Message | Venkatesh. K | 1999-02-01 15:41:44 |