From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: h8mastre@gmail.com
Subject: BUG #15476: Problem on show_trgm with 4 byte UTF-8 characters
Date: Thu, 01 Nov 2018 02:39:20 +0000
Message-ID: <15476-4314f480acf0f114@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 15476
Logged by: Kenji Uno
Email address: h8mastre@gmail.com
PostgreSQL version: 9.6.2
Operating system: Windows Server 2012 Japanese
Description:
# Problem on show_trgm with 4 byte UTF-8 characters
On Encoding=UTF-8 database, try:
SELECT show_trgm('123');
→ OK
SELECT show_trgm('日本語');
→ probably OK.
SELECT show_trgm('🔍');
→ ERROR!
ERROR: invalid multibyte character for locale
HINT: The server's LC_CTYPE locale is probably incompatible with the
database encoding.
SQL state: 22021
I have reviewed some of your source code. And I have found a suspect
point.
Please check: t_isdigit, t_isspace, t_isalpha, and t_isprint.
https://github.com/postgres/postgres/blob/322548a8abe225f2cfd6a48e07b99e2711d28ef7/src/backend/tsear...
char2wchar 4th parameter should take number of input bytes. However they
pass character count.
int clen = pg_mblen(ptr);
...
char2wchar(character, 2, ptr, clen, mylocale);
I'm afraid, but could you look into about this?
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 using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, h8mastre@gmail.com
Subject: Re: BUG #15476: Problem on show_trgm with 4 byte UTF-8 characters
In-Reply-To: <15476-4314f480acf0f114@postgresql.org>
* 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