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 1o7EBo-0005CN-Hv for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Jul 2022 10:47:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o7EBn-0001gQ-24 for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Jul 2022 10:47:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o7EBm-0001gG-Os for pgsql-hackers@lists.postgresql.org; Fri, 01 Jul 2022 10:47:54 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o7EBk-00039j-J0 for pgsql-hackers@postgresql.org; Fri, 01 Jul 2022 10:47:53 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 032B15C01A6; Fri, 1 Jul 2022 06:47:52 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 01 Jul 2022 06:47:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilmari.org; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1656672471; x= 1656758871; bh=esnnbXhr4MNEseO5NM3a8HXU4f1hM6CRFB7HMYb04Gw=; b=T rX0xgTHOOMp2pLMUB+QE3yhWBdOOa882QJHdRfzjb4QK1MMaCUoiwsRlniMZQ91H ei8EdZxZDNR/zWxsstfzvG+gBMeO+zP17PZGXyKVkO/JNIuDbz+ZGVNvb329FS51 4nvHuM8CiKAXNtO5dy59nUcS/wJ5q9yCi+YLdmv4/332RuLKfwiZGpV1ao7OOqWl vZolNJaCRoJxzqdWT1m1R7btwfdFuL+oUb3gMhHDqGJUxqYXpIPcOq8IdVaPYn5Z +oH7O/+6Us9JT1HDzbPGGyr0aBnKz77M/cVqgwYqjJ6aKfJkUJC9xO/ZS7shL9hP AVfCtCW4Fm0yQV07K03OA== 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=1656672471; x= 1656758871; bh=esnnbXhr4MNEseO5NM3a8HXU4f1hM6CRFB7HMYb04Gw=; b=s RQ6lRpf3hgHuXfCn3mGodprTbxK7SyP20qRt482yWxwdUS7PX1VtHXmJSSqvgv0L /hkl97cWoTKACbCGIJFNtmzfwi8Qz9eF99/F1LyLtBxb5/SvkqpVrN5G85S87ovw TiON0ulQNUWkjJBqkPfvUcWyaPwrkvRasGkov6d9KKE8bUTeIxRVTkNJXo39Dwe6 UB1xrMtfTjij12ITHlltP6TNo+fYoUg8adg2BnJs5y0bf754hItUAdfxJ6DCnEOP wpDrlzeyedG0K9MXFdRISYWfbAqRe7hXFPn45NW8Oyb7n7JhcZf8pqtb6ITgFawL KMeMVf+e/736e+D/VoXtQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudehfedgfeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufhffjgfkfgggtgfgsehtkeertddtreejnecuhfhrohhmpeffrghg fhhinhhnpgfklhhmrghrihgpofgrnhhnshonkhgvrhcuoehilhhmrghrihesihhlmhgrrh hirdhorhhgqeenucggtffrrghtthgvrhhnpeeggeekgfefheelkeeuhfevveektddtfedt ffeuveeujeeftdegtdetffegtdfhleenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpehilhhmrghrihesihhlmhgrrhhirdhorhhg X-ME-Proxy: Feedback-ID: i1ff147bf:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 1 Jul 2022 06:47:51 -0400 (EDT) From: =?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= To: Peter Eisentraut Cc: Tom Lane , pgsql-hackers Subject: Re: Refactor construct_array() and deconstruct_array() for built-in types References: <2914356f-9e5f-8c59-2995-5997fc48bcba@enterprisedb.com> <1844517.1651502932@sss.pgh.pa.us> <871qv5kt9y.fsf@wibble.ilmari.org> Date: Fri, 01 Jul 2022 11:47:50 +0100 In-Reply-To: <871qv5kt9y.fsf@wibble.ilmari.org> ("Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker=22's?= message of "Fri, 01 Jul 2022 11:43:21 +0100") Message-ID: <87y1xdjei1.fsf@wibble.ilmari.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Dagfinn Ilmari Mannsåker writes: > I dind't pay much attention to this thread earlier, but I was struck by > the duplication of the switch statement determining the elemlen, > elembyval, and elemalign values between the construct and deconstruct > functions. How about a common function they can both call? Something > like: > > static void builtin_type_details(Oid elemtype, > int *elemlen, > bool *elembyval, > char *elemalign); I just realised that this would require the error message to not include the function name (which isn't really that critical, since it's a developer-facing message), but an option would to make it return false for unknown types, so each of the calling functions can emit their own error message. > - ilmari