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 1sz8Kx-004OGz-Gd for pgsql-hackers@arkaria.postgresql.org; Fri, 11 Oct 2024 05:37:15 +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 1sz8Kv-00EQCs-Lm for pgsql-hackers@arkaria.postgresql.org; Fri, 11 Oct 2024 05:37:14 +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 1sz8Kv-00EQCF-82 for pgsql-hackers@lists.postgresql.org; Fri, 11 Oct 2024 05:37:13 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sz8Kr-000Shu-Ru for pgsql-hackers@lists.postgresql.org; Fri, 11 Oct 2024 05:37:13 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-430558cddbeso10615705e9.1 for ; Thu, 10 Oct 2024 22:37:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728625030; x=1729229830; darn=lists.postgresql.org; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=8jbvkb72XNeidlJeiknEN+4ni+kzmTi1TPB5bwoVvOc=; b=k5I5257m4mQeygGeDhTmEyE9oNPp7FJoWhcd1Tmx8N8nQRVg7mjJjLCI/O5+ByrTn5 HJC4i/b7OPeNDy3T/JS/kgmWpN6azp/9mY+jNN9MASOXUhv12MePI0L/8e3AXzUnhgT8 TsfpFH1kLjC61yjo4w7YId1XsKcNgTLWUsL8ISRVyHRRogrt3VsUewwA9xjKHnOZj9E8 1JE1X6MiV6a0ulK5+8GodloPRBBaBRjB1HjJeOg4wrSpDisqIDG0UoiO56ueVe8vE0fo CZuIne/Gfb/akIA/E0WbDOKVOVruK30eLgZ7F5QN/8uEgITh7SUy2NZPq/2Dv9y98+jR PMmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728625030; x=1729229830; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8jbvkb72XNeidlJeiknEN+4ni+kzmTi1TPB5bwoVvOc=; b=IYlRBGgOOI0ysyMem86teJDiMwhg7/7Vgm9gQDo3EdpV08Polra8zntIS9xFEVHlue hQTPgrC1f8c3NzwuI+6KAf7RLT/0ssrtQCLI3M8cCDhavAzzweBx+lEzAoFaGAN2l3S2 5Vd69zGG/e0t0OH+RY+28yJIvrONKCTrZSuPVQTARcxAqUVL0vJab69BhOMhWuFdv45a 85a+hegBocjAzJzxWnkc9ES4OPs8NOK9bz6CD6TIP6I6Cmn/EebXC/bB7L5DEo6RbphF UFYAaT2EUQD2BxW/0pLE2kCdJvloF7phMErNqjxxD7AA0BxKfStscEOeIWYjCTquW0Yy rrqg== X-Gm-Message-State: AOJu0Yxn6W4cncDYLSCSWtrf7k/Mrxol4Y83Le6sCX/S/+AsdmDEpSt2 1Zb9X+Qj7Ycz8ROfyjykNXZmKp3gUHyckyoFhVl8dDwmU1pfUHVkqqSTZw== X-Google-Smtp-Source: AGHT+IHj1aEttG93mjqMMauw85DRhRZpaOei3GeqswSSJbYfpZReu48dvvB7GPZoLBApkf+qGKL3Sg== X-Received: by 2002:a05:600c:154a:b0:42c:ae4e:a96c with SMTP id 5b1f17b1804b1-4311d937472mr10880525e9.16.1728625029572; Thu, 10 Oct 2024 22:37:09 -0700 (PDT) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-236-134-5.eu-west-3.compute.amazonaws.com. [15.236.134.5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431182d793fsm32524935e9.9.2024.10.10.22.37.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 22:37:08 -0700 (PDT) Date: Fri, 11 Oct 2024 05:37:07 +0000 From: Bertrand Drouvot To: pgsql-hackers@lists.postgresql.org Subject: Missing deconstruct_array_builtin usage Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="W3SU+sx8DdohRo7K" Content-Disposition: inline List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --W3SU+sx8DdohRo7K Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --W3SU+sx8DdohRo7K Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0001-Missing-deconstruct_array_builtin-usage.patch" From 814d608c39766dc550b4622cb10edd3654ac1c3a Mon Sep 17 00:00:00 2001 From: Bertrand Drouvot 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 --W3SU+sx8DdohRo7K--