On Sat, Oct 10, 2015 at 12:32 PM, Peter Geoghegan <p...@heroku.com> wrote: > I noticed that there is still one comment that I really should have > removed as part of this work.
I also noticed that I failed to reset the last_returned strcoll() cache variable as part of an abbreviation call, despite the fact that tapesort may freely interleave conversions with comparisons, while reusing buf1 and buf2 both as scratch space for strxfrm() blobs, as well as for storing strings to be compared with strcoll(). I suggest that the attached patch also be applied to fix this issue. -- Peter Geoghegan
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c index d545c34..9725a5f 100644 --- a/src/backend/utils/adt/varlena.c +++ b/src/backend/utils/adt/varlena.c @@ -2173,6 +2173,12 @@ bttext_abbrev_convert(Datum original, SortSupport ssup) done: /* + * Set last_returned to sentinel value. Comparisons that attempt to reuse + * last_returned may be interleaved with calls here. + */ + tss->last_returned = INT_MIN; + + /* * Byteswap on little-endian machines. * * This is needed so that bttextcmp_abbrev() (an unsigned integer 3-way
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers