Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hlJ2X-0002Qn-T0 for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Jul 2019 20:18:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hlJ2W-0003Mj-PA for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Jul 2019 20:18:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hlJ2W-0003Mc-Hf for pgsql-bugs@lists.postgresql.org; Wed, 10 Jul 2019 20:18:08 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hlJ2Q-00005U-7L for pgsql-bugs@lists.postgresql.org; Wed, 10 Jul 2019 20:18:08 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x6AKHuLb013247; Wed, 10 Jul 2019 16:17:56 -0400 From: Tom Lane To: Alvaro Herrera cc: Manuel Rigger , PostgreSQL mailing lists , Tomas Vondra Subject: Re: ERROR: negative bitmapset member not allowed in SELECT In-reply-to: <20190710200958.GA13132@alvherre.pgsql> References: <20190710200958.GA13132@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Wed, 10 Jul 2019 16:09:58 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <13245.1562789876.1@sss.pgh.pa.us> Date: Wed, 10 Jul 2019 16:17:56 -0400 Message-ID: <13246.1562789876@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera 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