Re: Expr. extended stats are skipped with equality operator

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Danny Shemesh <dany74q@gmail.com>, pgsql-hackers@postgresql.org, Tomas Vondra <tomas.vondra@enterprisedb.com>
Date: 2022-08-05T18:08:18Z
Lists: pgsql-hackers
Justin Pryzby <pryzby@telsasoft.com> writes:
> A reproducer for this:

> CREATE TABLE t1(x int[], y float);
> INSERT INTO t1 SELECT array[1], a FROM generate_series(1,99)a;
> CREATE STATISTICS s2 ON (CASE x[1] WHEN 1 THEN true ELSE false END), y FROM t1;
> ANALYZE t1; 

> explain analyze SELECT * FROM t1 WHERE CASE x[1] WHEN 1 THEN true ELSE false END AND y=1;
> ERROR:  unknown clause type: 134

Sigh ... this is just horrid.  I think I see what to do about it though,
and since Tomas seems to have been AWOL for awhile now, I don't think
we'll get a fix by Monday if we wait for him.  I'll take a shot at
fixing it; it seems unlikely that I can make it worse.

			regards, tom lane



Commits

  1. Fix handling of bare boolean expressions in mcv_get_match_bitmap.