Re: BUG #8821: pg_trgm segfault with Turkish locale database - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #8821: pg_trgm segfault with Turkish locale database
Date
Msg-id 10064.1389629385@sss.pgh.pa.us
Whole thread Raw
In response to BUG #8821: pg_trgm segfault with Turkish locale database  (ufuk@paralaus.com)
Responses Re: BUG #8821: pg_trgm segfault with Turkish locale database
List pgsql-bugs
ufuk@paralaus.com writes:
> Given a database with encoding UTF-8, locale tr_TR.UTF-8, 'pg_trgm'
> extension enabled, and the following setup:

> CREATE TABLE car_makers (maker TEXT);
> INSERT INTO car_makers VALUES ('AUDI'), ('MINI');

> Run any one of the following commands:

> - SELECT maker <-> 'MAZDA' FROM car_makers;
> - SELECT similarity(maker, 'MAZDA') FROM car_makers;
> - SELECT show_trgm('III');

> As a result, it seems there is a problem with trigrams generation and/or
> comparison when the Turkish locale is being used.

It looks like generate_trgm() is not considering the possibility that
case-folding will make the string physically longer, so you get a buffer
overrun when any of these I-containing strings are converted to trigrams.
Will fix, thanks for the report!

            regards, tom lane

pgsql-bugs by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: BUG #8822: What's the work around for the following exception?
Next
From: Maciek Sakrejda
Date:
Subject: BUG #8728: Toast table much larger on replica