Re: Fix var_eq_const: sum selectivity of all matching MCV entries instead of stopping at first match

From: ZizhuanLiu X-MAN <44973863(at)qq(dot)com>
To: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix var_eq_const: sum selectivity of all matching MCV entries instead of stopping at first match
Date: 2026-08-20 06:47:08
Message-ID: tencent_37FDD4E58D7DF0176DACB4C2132EDF039608@qq.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
I apologize for the issue in patches v2 and v3. They contained a bug
that caused an error when collid == 0. This has now been fixed.

For example:
xman7=# select * from pg_catalog.pg_attribute where attrelid = 16418;
ERROR: cache lookup failed for collation 0
xman7=#

DROP TABLE IF EXISTS char_stats_1;
CREATE TABLE char_stats_1 (c "char");

INSERT INTO char_stats_1
SELECT v::"char"
FROM unnest(array['I','S','c','i','m','p','r','t','v']) AS v,
generate_series(1, CASE WHEN v IN ('i','v','r','t') THEN 50 ELSE 1 END);

analyze char_stats_1;

select * from char_stats_1 where c = 'C';
return error:
ERROR: cache lookup failed for collation 0

regards,
--
ZizhuanLiu (X-MAN) 
44973863(at)qq(dot)com

Attachment Content-Type Size
v4-0001-Fix-var_eq_const-sum-selectivity-of-all-matching-.patch application/octet-stream 3.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2026-08-20 06:59:25 Re: Fix CPU cost of right-semi and right-anti hash joins
Previous Message Bharath Rupireddy 2026-08-20 06:25:00 Re: [PATCH] Release replication slot on error in SQL-callable slot functions