Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rteA0-00GSTS-41 for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Apr 2024 01:51:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rte9x-00Fjvr-Ul for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Apr 2024 01:50:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rte9x-00Fjtm-KP for pgsql-hackers@lists.postgresql.org; Mon, 08 Apr 2024 01:50:57 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rte9s-001kDt-Rs for pgsql-hackers@lists.postgresql.org; Mon, 08 Apr 2024 01:50:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 4381oePV3012167; Sun, 7 Apr 2024 21:50:41 -0400 From: Tom Lane To: Peter Geoghegan cc: Matthias van de Meent , PostgreSQL Hackers , Tomas Vondra , Jeff Davis , benoit , Alexander Korotkov Subject: Re: Optimizing nbtree ScalarArrayOp execution, allowing multi-column ordered scans, skip scan In-reply-to: References: <3000247.1712537309@sss.pgh.pa.us> <3008621.1712539538@sss.pgh.pa.us> Comments: In-reply-to Peter Geoghegan message dated "Sun, 07 Apr 2024 21:36:17 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3012165.1712541040.1@sss.pgh.pa.us> Date: Sun, 07 Apr 2024 21:50:40 -0400 Message-ID: <3012166.1712541040@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Peter Geoghegan writes: > The assertions in question are arguably redundant. There are very > similar assertions just a little earlier on, as we initially set up > the array stuff (right before _bt_compare_scankey_args is called). > I'll just remove the "Assert(xform[j].ikey == array->scan_key)" > assertion that Coverity doesn't like, in addition to the > "Assert(!array || array->scan_key == i)" assertion, on the grounds > that they're redundant. If you're doing that, then surely if (j != (BTEqualStrategyNumber - 1) || !(xform[j].skey->sk_flags & SK_SEARCHARRAY)) { ... } else { Assert(j == (BTEqualStrategyNumber - 1)); Assert(xform[j].skey->sk_flags & SK_SEARCHARRAY); Assert(xform[j].ikey == array->scan_key); Assert(!(cur->sk_flags & SK_SEARCHARRAY)); } those first two Asserts are redundant with the "if" as well. regards, tom lane