Re: BUG #19789: "expression not found in statistics object" for a boolean domain column in an MCV statistics object

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: ZizhuanLiu X-MAN <44973863(at)qq(dot)com>
Cc: Matheus Alcantara <matheusssilv97(at)gmail(dot)com>, alpkeles99 <alpkeles99(at)gmail(dot)com>, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #19789: "expression not found in statistics object" for a boolean domain column in an MCV statistics object
Date: 2026-11-30 01:12:09
Message-ID: awzNaZIYt8nGlkfr@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sun, Nov 29, 2026 at 08:45:31PM +0800, ZizhuanLiu X-MAN wrote:
> I reviewed the patch and think both changes are correct and
> consistent with the existing compatibility check.

Yeah. That looks right.

+SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_bool_domain WHERE a AND b AND c = 0');
+SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_bool_domain WHERE NOT a AND b');
+SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_bool_domain WHERE a = true AND b = false');
+SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_bool_domain WHERE (a OR b) AND c = 1');
+SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_bool_domain WHERE a AND (c > 4)::mcv_bool_domain');

I don't think that you need that many queries here. It would be
enough to cut that down to two patterns, as of:
WHERE a AND b;
WHERE NOT a AND b;

Will simplify and process that. Thanks for the report and the
patch!
--
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message shihao zhong 2026-11-30 04:06:42 Re: BUG #19941: Acknowledged INSERT lost after a simple Query inside an extended-protocol batch (XX000)
Previous Message Zsolt Parragi 2026-11-29 21:19:35 Re: BUG #19873: planner silently drops the second ORDER BY sort key when both keys reference the same expression und