Re: [HACKERS] Patch (was: tough locale bug)
От | Goran Thyni |
---|---|
Тема | Re: [HACKERS] Patch (was: tough locale bug) |
Дата | |
Msg-id | 36B5D89C.823C6E01@kirra.net обсуждение исходный текст |
Ответ на | Re: [HACKERS] Postgres Speed or lack thereof (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | 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!
В списке pgsql-hackers по дате отправления: