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 1rTMTb-002KAk-9N for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Jan 2024 13:42:36 +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 1rTMTY-00FtLW-HS for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Jan 2024 13:42:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rTMTW-00FtDw-FU for pgsql-hackers@lists.postgresql.org; Fri, 26 Jan 2024 13:42:32 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rTMTR-003pZe-Sc for pgsql-hackers@postgresql.org; Fri, 26 Jan 2024 13:42:29 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailout.west.internal (Postfix) with ESMTP id 3CB423200B0B; Fri, 26 Jan 2024 08:42:21 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Fri, 26 Jan 2024 08:42:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm2; t=1706276540; x=1706362940; bh=D4+VEI077ufMsR9HntMRSN+TPmBJRxZ1 l9d3dG1Z7QQ=; b=WPmZeiSYSq9K7MxB6/FVuYisfBLLo1OphvZhMab0Z7uYKZ4V nXMoj4PZpH3h/0yieDw1sFoIXihbZ0hpENGQgBTiF1p+8jRCJo+yaksVXSJ6q7HY ePrhHJcYSqm0hIwWtlSoPVYf/T5MWEGK81PvMGkOXsWdvrokkK5OvpXNfMDHBz4/ PK2UmvGNnB+oWf1hd7nqM+4wY5ePzXgYurX/zR12JluRbaJBrQHsFYQF6fOBxyI6 6bOWO0VRUb7adUenlka9TUFcZRmkKTP6hRhUtef8ONUD8RSgOGM11yYYfWw9CvU/ BLD496VacgUqRmdfti0+0Rcvtt/Pm86bRRadag== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1706276540; x= 1706362940; bh=D4+VEI077ufMsR9HntMRSN+TPmBJRxZ1l9d3dG1Z7QQ=; b=Z /eo9n1ODIDE+rvyALO8JV3zMorK/sya0z0bgIW8JFzVuOAD92SjXPcSgAYOHDmhi r6TA3JiCqPy1WwRyiADPcAWBSgyJkh6ymgVduNUhd5o8UNtDl+uCkpB68KMStxxc 59DFuuZ3KLRZgQ59GPM8JGRk8JoKtY2Z22K4Ty80CuAYZQBvhVRGkM1QTbPvFfCW MkiGBf4iwbpqZWoYsMVndfiyh06TKs3vAW3ZfWV6dkdt/vuxXIDgX7mDdVHsBn9M chkZjBzkvwX6O+9HS805QO7tpPXKrL2vWs+Aw3gsJLWwSzYEkl8o7sanw8Ee+tox QDRM7XVTzJVP2sTAjnrxw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdeljedgheefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpefrvght vghrucfgihhsvghnthhrrghuthcuoehpvghtvghrsegvihhsvghnthhrrghuthdrohhrgh eqnecuggftrfgrthhtvghrnhepgfejtdfhkeeftdeugfeileehteeljeeghfeuledthfeu tedvffdukeefjefhgeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepphgvthgvrhesvghishgvnhhtrhgruhhtrdhorhhg X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 26 Jan 2024 08:42:19 -0500 (EST) Message-ID: Date: Fri, 26 Jan 2024 14:42:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: tablecmds.c/MergeAttributes() cleanup Content-Language: en-US To: Ashutosh Bapat Cc: pgsql-hackers , Alvaro Herrera References: <20230829112028.qhzse7chs3swqwqh@alvherre.pgsql> <60beec03-f14c-ea46-8e5f-f68773ce83f9@eisentraut.org> <12e27bdb-1a3d-450f-923b-c36feea24f01@eisentraut.org> From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 24.01.24 07:27, Ashutosh Bapat wrote: > While working on identity support and now while looking at the > compression problem you referred to, I found MergeAttribute() to be > hard to read. It's hard to follow high level logic in that function > since the function is not modular. I took a stab at modularising a > part of it. Attached is the resulting patch series. > > 0001 is your patch as is > 0002 is pgindent fix and also fixing what I think is a typo/thinko > from 0001. If you are fine with the changes, 0002 should be merged > into 0003. > 0003 separates the part of code merging a child attribute to the > corresponding inherited attribute into its own function. > 0004 does the same for code merging inherited attributes incrementally. > > I have kept 0003 and 0004 separate in case we pick one and not the > other. But they can be committed as a single commit. I have committed all this. These are great improvements. (One little change I made to your 0003 and 0004 patches is that I kept the check whether the new column matches an existing one by name in MergeAttributes(). I found that pushing that down made the logic in MergeAttributes() too hard to follow. But it's pretty much the same.)