pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ufuk Kayserilioglu <ufuk@paralaus.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #8821: pg_trgm segfault with Turkish locale database
Date: Mon, 13 Jan 2014 18:17:13 +0200
Message-ID: <etPan.52d41189.74de0ee3.c82f@Ufuk-MBA-2.local> (raw)
In-Reply-To: <10064.1389629385@sss.pgh.pa.us>
References: <20140113125641.30125.40578@wrigleys.postgresql.org>
	<10064.1389629385@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Hi Tom,

Thanks for the quick response. Just a quick followup note though; running:

SELECT show_trgm(maker) FROM car_makers;

behaves properly, but trying to make a similarity comparison triggers the segfault (at least in my case). That's why I suspect there may be 2 related bugs, one related trigram generation and, maybe, one related to trigram comparison. Hope this info will help you as well.

Regards,

--
Ufuk Kayserilioglu

From: Tom Lane Tom Lane
Reply: Tom Lane tgl@sss.pgh.pa.us
Date: 13 January 2014 at 18:09:46
To: ufuk@paralaus.com ufuk@paralaus.com
Subject:  Re: [BUGS] BUG #8821: pg_trgm segfault with Turkish locale database  
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  

view thread (5+ messages)  latest in thread

Message-ID: <etPan.52d41189.74de0ee3.c82f@Ufuk-MBA-2.local>
Permalink:  ../etPan.52d41189.74de0ee3.c82f@Ufuk-MBA-2.local/
Also on:    postgresql.org/message-id/etPan.52d41189.74de0ee3.c82f@Ufuk-MBA-2.local

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: ufuk@paralaus.com, tgl@sss.pgh.pa.us
  Subject: Re: BUG #8821: pg_trgm segfault with Turkish locale database
  In-Reply-To: <etPan.52d41189.74de0ee3.c82f@Ufuk-MBA-2.local>
  References: <20140113125641.30125.40578@wrigleys.postgresql.org> <10064.1389629385@sss.pgh.pa.us> <etPan.52d41189.74de0ee3.c82f@Ufuk-MBA-2.local>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox