BUG #19633: Unexpected results of IN (subquery) with a non-deterministic collation

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: syzhong16(at)gmail(dot)com
Subject: BUG #19633: Unexpected results of IN (subquery) with a non-deterministic collation
Date: 2026-08-20 03:49:53
Message-ID: 19633-647cd4c73a84b085@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 19633
Logged by: Suyang Zhong
Email address: syzhong16(at)gmail(dot)com
PostgreSQL version: 19beta3
Operating system: Ubuntu 22.04
Description:

Hi,

Consider the following test case:

```
CREATE COLLATION ci (provider = icu, locale = 'und-u-ks-level1',
deterministic = false);

CREATE TABLE t_lhs(c1 text COLLATE ci);
CREATE TABLE t_rhs(c0 text);
INSERT INTO t_lhs VALUES ('a'), ('x'), ('y');
INSERT INTO t_rhs VALUES ('a'), ('a');
ANALYZE t_lhs;
ANALYZE t_rhs;
INSERT INTO t_rhs VALUES ('A');

SELECT c1, c1 IN (SELECT c0 FROM t_rhs) AS p FROM t_lhs;
-- a | t
-- x | f
-- y | f

SELECT count(*) FROM t_lhs WHERE c1 IN (SELECT c0 FROM t_rhs);
-- Expected: 1, Actual: 2
```

The predicate evaluates to true for one row, so filtering on the same
predicate should return one row.

Reproduced on 20devel and 19beta3.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2026-08-20 07:06:20 Re: BUG #19623: Postmaster livelocks respawning io workers when children die after crash restart; pg_ctl stop fails
Previous Message Michael Paquier 2026-08-20 02:21:47 Re: BUG #19623: Postmaster livelocks respawning io workers when children die after crash restart; pg_ctl stop fails