Re: regex match and special characters

From: Oleksii Kliukin <alexk(at)hintbits(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: regex match and special characters
Date: 2018-08-18 14:24:58
Message-ID: FF4AA68A-92CA-4975-AC37-CAE2ECE6310C@hintbits.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> On 16. Aug 2018, at 16:57, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Alex Kliukin <alexk(at)hintbits(dot)com> writes:
>> Here is a simple SQL statement that gives different results on PostgreSQL 9.6 and PostgreSQL 10+. The space character at the end of the string is actually U+2006 SIX-PER-EM SPACE (http://www.fileformat.info/info/unicode/char/2006/index.htm)
>
> I think the reason for the discrepancy is that in v10 we fixed the regex
> locale support so that it could properly classify code points above U+7FF,
> cf
>
> https://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=c54159d44ceaba26ceda9fea1804f0de122a8f30 <https://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=c54159d44ceaba26ceda9fea1804f0de122a8f30>

This nails down the cause, thanks a lot for the link! Apparently I missed it from PostgreSQL 10 release notes, where it is present in the “Queries” section, although AFAIK it deserved an entry in the "migration to version 10”, as it may potentially make dump/restore from previous versions to version 10 error out if there are table constraints that use regex classes over the Unicode text fields with code points above U+7FF.

>
> So 10 is giving the right answer (i.e. that \s matches U+2006).
> 9.x is not

Agreed.

Cheers,
Alex

In response to

Browse pgsql-general by date

  From Date Subject
Next Message kpi6288 2018-08-18 14:32:34 AW: AW: CTE with JOIN of two tables is much faster than a regular query
Previous Message Adrian Klaver 2018-08-18 14:24:28 Re: AW: CTE with JOIN of two tables is much faster than a regular query