pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Manuel Rigger <rigger.manuel@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Subject: Re: ERROR: negative bitmapset member not allowed in SELECT
Date: Wed, 10 Jul 2019 16:09:58 -0400
Message-ID: <20190710200958.GA13132@alvherre.pgsql> (raw )
In-Reply-To: <CA+u7OA65+jEFb_TyV5g+Kq+onyJ2skMOPzgTgFH+qgLwszRqvw@mail.gmail.com >
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:
#0 errfinish (dummy=dummy@entry=0) at /pgsql/source/master/src/backend/utils/error/elog.c:411
#1 0x0000559f2b8ca430 in elog_finish (elevel=elevel@entry=20, fmt=fmt@entry=0x559f2ba6f538 "negative bitmapset member not allowed") at /pgsql/source/master/src/backend/utils/error/elog.c:1365
#2 0x0000559f2b6801f5 in bms_is_member (x=<optimized out>, a=<optimized out>) at /pgsql/source/master/src/backend/nodes/bitmapset.c:434
#3 0x0000559f2b68021d in bms_member_index (a=a@entry=0x559f2da39918, x=-30672) at /pgsql/source/master/src/backend/nodes/bitmapset.c:462
#4 0x0000559f2b758841 in mcv_get_match_bitmap (root=root@entry=0x559f2d9e2e78, clauses=clauses@entry=0x559f2da3a6f0, keys=0x559f2da39918, mcvlist=mcvlist@entry=0x559f2da3a938, is_or=is_or@entry=false) at /pgsql/source/master/src/backend/statistics/mcv.c:1597
#5 0x0000559f2b75b551 in mcv_clauselist_selectivity (root=root@entry=0x559f2d9e2e78, stat=stat@entry=0x559f2da398e0, clauses=clauses@entry=0x559f2da3a6f0, varRelid=varRelid@entry=2, jointype=jointype@entry=JOIN_INNER, sjinfo=sjinfo@entry=0x0, rel=0x559f2d9e1a10, basesel=0x7ffc17135958, totalsel=0x7ffc17135960) at /pgsql/source/master/src/backend/statistics/mcv.c:1876
#6 0x0000559f2b756dc4 in statext_mcv_clauselist_selectivity (estimatedclauses=0x7ffc171359f0, rel=<optimized out>, sjinfo=<optimized out>, jointype=<optimized out>, varRelid=<optimized out>, clauses=<optimized out>, root=<optimized out>) at /pgsql/source/master/src/backend/statistics/extended_stats.c:1146
#7 statext_clauselist_selectivity (root=root@entry=0x559f2d9e2e78, clauses=clauses@entry=0x559f2da3a430, varRelid=varRelid@entry=2, jointype=jointype@entry=JOIN_INNER, sjinfo=sjinfo@entry=0x0, rel=<optimized out>, estimatedclauses=0x7ffc171359f0) at /pgsql/source/master/src/backend/statistics/extended_stats.c:1177
#8 0x0000559f2b6a98d1 in clauselist_selectivity (root=root@entry=0x559f2d9e2e78, clauses=0x559f2da3a430, varRelid=2, jointype=jointype@entry=JOIN_INNER, sjinfo=sjinfo@entry=0x0) at /pgsql/source/master/src/backend/optimizer/path/clausesel.c:94
#9 0x0000559f2b8767e6 in btcostestimate (root=0x559f2d9e2e78, path=0x559f2da38ef0, loop_count=1, indexStartupCost=0x7ffc17135c48, indexTotalCost=0x7ffc17135c50, indexSelectivity=0x7ffc17135c58, indexCorrelation=0x7ffc17135c60, indexPages=0x7ffc17135c78) at /pgsql/source/master/src/backend/utils/adt/selfuncs.c:5853
#10 0x0000559f2b6adc39 in cost_index (path=path@entry=0x559f2da38ef0, root=root@entry=0x559f2d9e2e78, loop_count=loop_count@entry=1, partial_path=partial_path@entry=false) at /pgsql/source/master/src/backend/optimizer/path/costsize.c:545
#11 0x0000559f2b6e9504 in create_index_path (root=root@entry=0x559f2d9e2e78, index=index@entry=0x559f2d9e1c28, indexclauses=indexclauses@entry=0x559f2da3a358, indexorderbys=indexorderbys@entry=0x0, indexorderbycols=indexorderbycols@entry=0x0, pathkeys=pathkeys@entry=0x0, indexscandir=ForwardScanDirection, indexonly=false, required_outer=0x0, loop_count=loop_count@entry=1, partial_path=false) at /pgsql/source/master/src/backend/optimizer/util/pathnode.c:1054
#12 0x0000559f2b6b67c5 in build_index_paths (root=root@entry=0x559f2d9e2e78, rel=rel@entry=0x559f2d9e1a10, index=index@entry=0x559f2d9e1c28, clauses=clauses@entry=0x7ffc17135f10, useful_predicate=<optimized out>, scantype=scantype@entry=ST_ANYSCAN, skip_nonnative_saop=<optimized out>, skip_lower_saop=<optimized out>) at /pgsql/source/master/src/backend/optimizer/path/indxpath.c:1039
#13 0x0000559f2b6b6ece in get_index_paths (root=root@entry=0x559f2d9e2e78, rel=rel@entry=0x559f2d9e1a10, index=index@entry=0x559f2d9e1c28, clauses=clauses@entry=0x7ffc17135f10, bitindexpaths=bitindexpaths@entry=0x7ffc17135ef0) at /pgsql/source/master/src/backend/optimizer/path/indxpath.c:754
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
view thread (5+ messages) latest in thread
Message-ID: <20190710200958.GA13132@alvherre.pgsql>
Permalink: ../20190710200958.GA13132@alvherre.pgsql/
Also on: postgresql.org/message-id/20190710200958.GA13132@alvherre.pgsql
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: alvherre@2ndquadrant.com, rigger.manuel@gmail.com, tomas.vondra@2ndquadrant.com
Subject: Re: ERROR: negative bitmapset member not allowed in SELECT
In-Reply-To: <20190710200958.GA13132@alvherre.pgsql>
References: <CA+u7OA65+jEFb_TyV5g+Kq+onyJ2skMOPzgTgFH+qgLwszRqvw@mail.gmail.com> <20190710200958.GA13132@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox