On Thu, Feb 9, 2017 at 7:58 AM, Peter Eisentraut <peter.eisentr...@2ndquadrant.com> wrote: > I think I have this sorted out. What I don't understand, however, is > why varstr_abbrev_convert() makes a point of looping until the result of > strxfrm() fits into the output buffer (buf2), when we only need 8 bytes, > and we throw away the rest later. Wouldn't it work to just request 8 bytes?
Maybe. We do that because strxfrm() is not required by the standard to produce well defined contents for the buffer when the return value indicates that it didn't fit entirely. This is a standard idiom, I think. > If there is a problem with just requesting 8 bytes, then I'm wondering > how this would affect the ICU code branch. This must be fine with ICU's ucol_nextSortKeyPart(), because it is designed for the express purpose of producing only a few bytes of the final blob at a time. -- Peter Geoghegan -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers