BUG #15285: Query used index over field with ICU collation in some cases wrongly return 0 rows

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: roman(dot)lytovchenko(at)gmail(dot)com
Subject: BUG #15285: Query used index over field with ICU collation in some cases wrongly return 0 rows
Date: 2018-07-19 16:03:05
Message-ID: 153201618542.1404.3611626898935613264@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15285
Logged by: Roman Lytovchenko
Email address: roman(dot)lytovchenko(at)gmail(dot)com
PostgreSQL version: 10.4
Operating system: fedora
Description:

How to reproduce:
CREATE COLLATION digitslast (provider = icu, locale =
'en(at)colReorder=latn-digit');
CREATE TABLE t (b CHAR(4) NOT NULL COLLATE digitslast);
insert into t select '0000' from generate_series (0, 1000) as f(x);
insert into t select '0001' from generate_series (0, 1000) as f(x);
insert into t select 'ABCD' from generate_series (0, 1000) as f(x);

create index i on t(b);
select * from t where b = '0000' ;
-- 0 rows, and this is a bug

explain analyze select * from t where b = '0000' ;
Index Only Scan using i on t (cost=0.28..41.80 rows=1001 width=5) (actual
time=0.045..0.045 rows=0 loops=1)
Index Cond: (b = '0000'::bpchar)
Heap Fetches: 0
Planning time: 0.146 ms
Execution time: 0.080 ms

drop index i;
select * from t where b = '0000' ;
-- 1001 rows

So, select version();
PostgreSQL 10.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.0.1 20180324
(Red Hat 8.0.1-0.20), 64-bit
$cat /proc/version
Linux version 3.10.0-514.10.2.el7.x86_64 (builder(at)kbuilder(dot)dev(dot)centos(dot)org)
(gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP Fri Mar 3
00:04:05 UTC 2017

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Geoghegan 2018-07-19 16:44:32 Re: BUG #15285: Query used index over field with ICU collation in some cases wrongly return 0 rows
Previous Message Tom Lane 2018-07-19 14:20:22 Re: BUG #15284: SSL connection is off