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 1mIt0Z-0006KD-08 for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Aug 2021 13:31:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mIt0Y-0005Ey-01 for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Aug 2021 13:31:58 +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 1mIt0X-0005Em-OL for pgsql-hackers@lists.postgresql.org; Wed, 25 Aug 2021 13:31:57 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mIt0V-0004M8-0L for pgsql-hackers@postgresql.org; Wed, 25 Aug 2021 13:31:57 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 545943200AC6; Wed, 25 Aug 2021 09:31:51 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 25 Aug 2021 09:31:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=sg3REb4MUpooC0gPF+aNOFm1IouvrxAPFSljV0EEbmc=; b=RJllBLSn D+TOjmi4JyVG7avCyXxiFtxz8r2n0GHKSlmhVj6ZIBlKH2ItSYvvU33ZBOtcHPzm mgEyoBf3AV2tDYc2lQxKxCwl06eExnrWQICngTS4G03CamRX5x3z8WeGPLh7pYa7 LnS+SFNznMKhvuGPTtPCFmeOTDAkRqArbqfONx7K1ZhjTjbRNeAhFpaF4sPmPhIi Fzowfa+qRW6pQVy7jYcEhb7OBs7O4fuKJCEQ4T5/tqpRweJue31SvvAMvP4D8hk6 anrote5FsZGI6Vdskvz71eSWayIRw9sBYSYBu9ekWmOAkR3bIy/0TbGhjPL31HrC RaoK+8QCODrvAg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddtledgieehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpeekkeffgffhtdffueetjeehtdehgeekleejkeeiveevgefh hffhtefggedvjefhheenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmpd gsuhhrnhhinhhgsghirhgurdhnvghtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 25 Aug 2021 09:31:49 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id D877D2A06E8; Wed, 25 Aug 2021 09:31:46 -0400 (-04) Date: Wed, 25 Aug 2021 09:31:46 -0400 From: Alvaro Herrera To: Michael Paquier Cc: Peter Eisentraut , pgsql-hackers Subject: Re: Some RELKIND macro refactoring Message-ID: <202108251331.6jfqss3vfrtv@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-Aug-25, Michael Paquier wrote: > On Tue, Aug 24, 2021 at 12:01:33PM +0200, Peter Eisentraut wrote: > > While analyzing this again, I think I found an existing mistake. The > > handling of RELKIND_PARTITIONED_INDEX in RelationGetNumberOfBlocksInFork() > > seems to be misplaced. See attached patch. Agreed, that's a mistake. > Right. This maps with RELKIND_HAS_STORAGE(). Makes me wonder whether > is would be better to add a check on RELKIND_HAS_STORAGE() in this > area, even if that's basically the same as the Assert() already used > in this code path. Well, the patch replaces the switch on individual relkind values with if tests on RELKIND_HAS_FOO macros. I suppose we'd have Assert(RELKIND_HAS_STORAGE(relkind)); so the function would not even be called for partitioned indexes. (In a quick scan of 'git grep RelationGetNumberOfBlocks' I see nothing that would obviously call this function on a partitioned index.) -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "XML!" Exclaimed C++. "What are you doing here? You're not a programming language." "Tell that to the people who use me," said XML. https://burningbird.net/the-parable-of-the-languages/