Re: ERROR: negative bitmapset member not allowed in SELECT

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Manuel Rigger <rigger(dot)manuel(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Subject: Re: ERROR: negative bitmapset member not allowed in SELECT
Date: 2019-07-10 20:17:56
Message-ID: 13246.1562789876@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> On 2019-Jul-10, Manuel Rigger wrote:
>> CREATE TABLE t0(c0 serial, c1 boolean);
>> CREATE STATISTICS s1 ON c0, c1 FROM t0;
>> INSERT INTO t0(c1) VALUES(TRUE);
>> ANALYZE;
>> CREATE INDEX i0 ON t0(c0, (t0.c1 AND t0.c1));
>> SELECT * FROM (SELECT t0.c0 FROM t0 WHERE (((t0.c1) AND (t0.c1)) OR
>> FALSE) IS TRUE) as result WHERE result.c0 IS NULL; -- unexpected:
>> ERROR: negative bitmapset member not allowed

> Backtrace:

I'd say that mcv_get_match_bitmap has a completely misplaced level of
faith that any OpExpr it's handed will have a plain Var on one side
or the other.

Not to mention an untenable assumption that the other side is a plain
Const.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-07-10 20:25:49 Re: ERROR: found unexpected null value in index
Previous Message Andres Freund 2019-07-10 20:15:47 Re: ERROR: found unexpected null value in index