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 1o7I8D-0006pA-VA for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Jul 2022 15:00:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o7I8C-000154-Du for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Jul 2022 15:00:28 +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 1o7I8B-00014v-Kc for pgsql-hackers@lists.postgresql.org; Fri, 01 Jul 2022 15:00:28 +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 1o7I86-0007kG-GY for pgsql-hackers@postgresql.org; Fri, 01 Jul 2022 15:00:27 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 4A04432009D4; Fri, 1 Jul 2022 11:00:18 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 01 Jul 2022 11:00:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1656687617; x= 1656774017; bh=4OuVE1WRNjN+SU3vGy1wFVopQ8HfVU1wglLy+ePhdJo=; b=W Upbv5fIuGLcB1UkaOpePHpVlpmdoR5qbwsghQe9jbaT4ZZ8UfZa0dTAYcytKlVss 9nplbHqsF8Wg/0ZH9nWMNK6XZelMNfSH3kOcEGntLCGbCV4VnlBWV4Xy/ofyevhl FotqfUdAXHzZqox5yUHH4RGwZg+Uf7NGfSqSzTG9g0Dr+XTWcscl2tNcgSHjp0+u 9SV83tT2sJ60NRC+KaNjfE+/esgR77TOb/++pRNVyzGEYepSISmpV+xT4o2SyA9B 4iCVgxyNCub+epB26ZjsC/BLRyOZZVFJpm+Tj/2k3j1SfanQjIMyHxvJWcCjXqqX HX/hERrP4a8yy94oyZ7wg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudehfedgkeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpefrvght vghrucfgihhsvghnthhrrghuthcuoehpvghtvghrrdgvihhsvghnthhrrghuthesvghnth gvrhhprhhishgvuggsrdgtohhmqeenucggtffrrghtthgvrhhnpeehleffgeegudejteei hfelteduvdeifffhffdvjedvffegjeekudeludehudeifeenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvghnthhrrghu thesvghnthgvrhhprhhishgvuggsrdgtohhm X-ME-Proxy: Feedback-ID: i131946ab:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 1 Jul 2022 11:00:16 -0400 (EDT) Message-ID: <94f0b960-62d4-4704-ffa7-ccd3f08f6512@enterprisedb.com> Date: Fri, 1 Jul 2022 17:00:14 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: Refactor construct_array() and deconstruct_array() for built-in types Content-Language: en-US To: Tom Lane , =?UTF-8?Q?Dagfinn_Ilmari_Manns=c3=a5ker?= Cc: pgsql-hackers References: <2914356f-9e5f-8c59-2995-5997fc48bcba@enterprisedb.com> <1844517.1651502932@sss.pgh.pa.us> <871qv5kt9y.fsf@wibble.ilmari.org> <87y1xdjei1.fsf@wibble.ilmari.org> <716889.1656682679@sss.pgh.pa.us> From: Peter Eisentraut In-Reply-To: <716889.1656682679@sss.pgh.pa.us> 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 01.07.22 15:37, Tom Lane wrote: > Perhaps a good compromise could be to turn the duplicated code into > a macro that's instantiated in both places? But I don't actually > see anything much wrong with the code as Peter has it. There are opportunities to refine this further. For example, there is similar code in TupleDescInitBuiltinEntry(), and bootstrap.c also contains hardcoded info on built-in types, and GetCCHashEqFuncs() is also loosely related. As I mentioned earlier in the thread, one could have genbki.pl generate support code for this.