Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fij82-0002Hf-DJ for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Jul 2018 16:28:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fij80-0001ak-63 for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Jul 2018 16:28:36 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1fij7z-0001aV-VJ for pgsql-hackers@lists.postgresql.org; Thu, 26 Jul 2018 16:28:36 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fij7s-0006Gp-Ip for pgsql-hackers@postgresql.org; Thu, 26 Jul 2018 16:28:35 +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 w6QGSNXA016591; Thu, 26 Jul 2018 12:28:23 -0400 From: Tom Lane To: Rajkumar Raghuwanshi cc: pgsql-hackers Subject: Re: negative bitmapset member not allowed Error with partition pruning In-reply-to: References: Comments: In-reply-to Rajkumar Raghuwanshi message dated "Thu, 26 Jul 2018 15:40:01 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <16589.1532622503.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 26 Jul 2018 12:28:23 -0400 Message-ID: <16590.1532622503@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Rajkumar Raghuwanshi writes: > I am getting "ERROR: negative bitmapset member not allowed" when > enable_partition_pruning set to true with below test case. Confirmed here. It's failing in perform_pruning_combine_step, which reaches this: result->bound_offsets =3D bms_add_range(NULL, 0, boundinfo->ndatum= s - 1); with boundinfo->ndatums =3D=3D 0. It's not clear to me whether that situa= tion should be impossible or not. If it is valid, perhaps all we need is something like if (boundinfo->ndatums > 0) result->bound_offsets =3D bms_add_range(NULL, 0, boundinfo->nd= atums - 1); else result->bound_offsets =3D NULL; although that then opens the question of whether downstream code is OK with bound_offsets being empty. (BTW, I'm not sure that it was wise to design bms_add_range to fail for empty ranges. Maybe it'd be better to redefine it as a no-op for upper < lower?) regards, tom lane