Pasi Eronen <pe@iki.fi> writes:
> In varlena.c, ssup_extra->buf1 and buf2 are initialized to 1024-byte
> buffers, allocated from the ssup->ssup_cxt memory context. That
> strange-looking test string in my bug report just happens to be 1044
> bytes, so a larger buffer is needed at some point.
> If growing the buffer happens in "varstrfastcmp_locale", it uses
> MemoryContextAlloc(ssup->ssup_cxt, ...). But if growing the buffer
> happens in "varstr_abbrev_convert", it just calls "palloc" - and
> apparently the current memory context is not ssup_cxt at this point
> (at least according to debugging printf's I added).
> Might this be causing the problem?
Indeed. The whole thing seems flat-out wrong to me: repalloc
would be shorter, safer, and more idiomatic.
regards, tom lane