Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nwSZa-0007Vo-28 for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Jun 2022 17:55:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nwSZY-0003Fv-Uf for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Jun 2022 17:55:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nwSZY-0003Fm-L1 for pgsql-hackers@lists.postgresql.org; Wed, 01 Jun 2022 17:55:56 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nwSZW-0006rr-AQ for pgsql-hackers@postgresql.org; Wed, 01 Jun 2022 17:55: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 251HtqKN635072; Wed, 1 Jun 2022 13:55:52 -0400 From: Tom Lane To: Zhihong Yu cc: Nathan Bossart , PostgreSQL-development Subject: Re: silence compiler warning in brin.c In-reply-to: References: <20220601163537.GA2331988@nathanxps13> <626379.1654103181@sss.pgh.pa.us> Comments: In-reply-to Zhihong Yu message dated "Wed, 01 Jun 2022 10:58:20 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <635070.1654106152.1@sss.pgh.pa.us> Date: Wed, 01 Jun 2022 13:55:52 -0400 Message-ID: <635071.1654106152@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Zhihong Yu writes: > Hi, > if (heapRel == NULL || heapoid != IndexGetRelation(indexoid, false)) > ereport(ERROR, > I wonder why the above check is not placed in the else block: > else > heapRel = NULL; Because we don't want to throw that error until we've exhausted the possibilities for throwing other errors. regards, tom lane