Hi hackers,

While working on [1], I noticed that we missed using deconstruct_array_builtin()
in 062a8444242.

Indeed, d746021de1 added construct_array_builtin and deconstruct_array_builtin
but , later on, 062a8444242 made use of deconstruct_array for TEXTOID.

Please find attached a tiny patch to add the $SUBJECT.

That does not fix any issues, it just removes this unnecessary hardcoded
parameters related to TEXTOID passed to deconstruct_array.

A quick check:

$ git grep construct_array | grep OID | grep -v builtin
src/backend/catalog/pg_publication.c:           deconstruct_array(arr, TEXTOID, 
-1, false, TYPALIGN_INT,
src/backend/utils/fmgr/funcapi.c:        * For the OID and char arrays, we 
don't need to use deconstruct_array()

shows that this is the "only" miss since d746021de1, so I still don't think it
has to be more "complicated" than it is currently (as already mentioned by Peter
in [2]).

[1]: 
https://www.postgresql.org/message-id/ZwdK1UYdLn/zFMHy%40ip-10-97-1-34.eu-west-3.compute.internal
[2]: 
https://www.postgresql.org/message-id/2914356f-9e5f-8c59-2995-5997fc48bcba%40enterprisedb.com

Looking forward to your feedback,

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
>From 814d608c39766dc550b4622cb10edd3654ac1c3a Mon Sep 17 00:00:00 2001
From: Bertrand Drouvot <bertranddrouvot...@gmail.com>
Date: Fri, 11 Oct 2024 04:27:59 +0000
Subject: [PATCH v1] Missing deconstruct_array_builtin usage

d746021de1 added construct_array_builtin and deconstruct_array_builtin but
, later on, 062a8444242 made use of deconstruct_array for TEXTOID. Making use of
deconstruct_array_builtin instead. That does not fix any issues, it just removes
this unnecessary hardcoded parameters related to TEXTOID passed to
deconstruct_array.
---
 src/backend/catalog/pg_publication.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
 100.0% src/backend/catalog/

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 7fe5fe2b86..7e5e357fd9 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -1059,8 +1059,7 @@ pg_get_publication_tables(PG_FUNCTION_ARGS)
 		 * publication name.
 		 */
 		arr = PG_GETARG_ARRAYTYPE_P(0);
-		deconstruct_array(arr, TEXTOID, -1, false, TYPALIGN_INT,
-						  &elems, NULL, &nelems);
+		deconstruct_array_builtin(arr, TEXTOID, &elems, NULL, &nelems);
 
 		/* Get Oids of tables from each publication. */
 		for (i = 0; i < nelems; i++)
-- 
2.34.1

Reply via email to