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.96) (envelope-from ) id 1w0a3Y-0021qP-24 for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Mar 2026 07:02:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w0a2X-00DazE-1b for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Mar 2026 07:01:01 +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.96) (envelope-from ) id 1w0a2X-00Daz6-0i for pgsql-hackers@lists.postgresql.org; Thu, 12 Mar 2026 07:01:01 +0000 Received: from mail-yx1-xb12b.google.com ([2607:f8b0:4864:20::b12b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w0a2U-00000002GGb-3PcQ for pgsql-hackers@lists.postgresql.org; Thu, 12 Mar 2026 07:01:01 +0000 Received: by mail-yx1-xb12b.google.com with SMTP id 956f58d0204a3-649278a69c5so676915d50.3 for ; Thu, 12 Mar 2026 00:00:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773298856; cv=none; d=google.com; s=arc-20240605; b=DrafIh7vUzFYecxUrTU1I3mxPP2NspLBMTVw5mIug253EB8ThssKRDLPAJHPFboekn k/nSAYL/Qq6AocXLc1wNCHvqEv42IwjGGvPWzUZDd1l4X3VvIpDrgNMQgF4+ab87McrQ LHmFBFl2s3/i0hC46defpwbl4X2D5j9K0GguDNol2Cinzw4E5wIytFP2ai/SVdp5j/FE Ror6mfDkv+Z+9SB5l7I7/T/BHZR4z8pCchXzBLLcDr4hbIyyDerPkYza3+0kp0mAWHAW WBuhqUUFbUFYc5slfNK9CgUKlxiW7UXyuM5b3QAMg52WGY7goR94U951ALFivkDK8djG 9JaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=1MrnpP3MOJKufJN0LPHWt++5qgvoqo8OSCziwMHaY2Q=; fh=5CZVuSQZkvlwBMBUZqeZhIp3CCM8FFZJC6jBOQgkVo4=; b=LB6VXvkpA9hVJluX4liMk4cBG82uSGse+Megyu/dSG17fdkLA2TSLHlr13U47TOoc+ ISpzNTD3vxhSU1LP38f/6Zwx/I+K9wB61tuSTMN+VHSbWczYVqvwb0z3FV7nH2Do3VjI sTnVi26CtJW9ar2LtYG2EYa/6p849rCUYD/iNnY/uK2YJhK51DFEavi1PBkHIRSvMvZk gKkoePwjE7bo/8EFJYGN5mJHBXb9NrYD+9VckKjZK9tfZLpARjqqNyMMHUFrK/Pb4+50 fhqZvu2oxBVAJc29xj6GRDa2z5SDz7Y1oTd7kEjM+SCDnt04viO/zTf4CHky1l62n+Qw 3KNw==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773298856; x=1773903656; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=1MrnpP3MOJKufJN0LPHWt++5qgvoqo8OSCziwMHaY2Q=; b=Ta8kawS8J4jQ2uSTz9lBfFatauT3Cwt8qHcftHpaqisit/imAaK0NEQZm3gfe5Hhje sqs2/u3xBbbEXJfevW/9GnHZXSw6/trdU3JBvdY0IiP1jdfvMCsox81BKCfRPmbZUays AF0fslXoyJ7pPbsinj3V3o98yTjAzlA/A/R8xP3Sm0v8lAlnpI5mB9uL/+T6nczKX3TX 0ILEZJOFMzVkyKUYLUe2XJ9W3Z/BiYPmQgLNhZky+oYahp9KfwIRfXWGtSnSzVQXOKwQ LWLctMsm9+ShvNnH2DsoIo9dQG/MszJ4EaFkGcKJd+lM36EWqZgc7VMaN/p476UMc7+0 gd6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773298856; x=1773903656; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1MrnpP3MOJKufJN0LPHWt++5qgvoqo8OSCziwMHaY2Q=; b=LkrZBhP9BQbLz6pZmSnLX6rvsh0JYphWG/uqqkanvKVIG2R4/tMCxUxh+YY3W5CoSC oB0qW5l14E1+nS0VyiTETbW7gl9QFkNOlgU//8WYLPlseIMd1fGyWdgcwKNdJTMzJyg7 a8qazbwo1ev7MOx/r+vZ0N73vSFCz0/i69SbyItDLZWlgrjjCflbbhTzXlDtbcDa6gWx 4DbutPXuIZfAXK8NFZaV/QZrW9bhFP7nznWrFgQsCdHvln4nCqZvbpnoSavdvWBLXrtg m194HoysnDMlV5W3GZrxaevCy2J/nVVAMTCXvwB9a0sFV2M7cOcPgaolcqAtZBzuVTdY kdQg== X-Forwarded-Encrypted: i=1; AJvYcCV9CPPDLsW4XlhSmphRwbjB5i9pAsMJIbR30CYkZCZ3FW/urWiNaCGihQatQpGcjngwwZM//rxf2jOj4uiU@lists.postgresql.org X-Gm-Message-State: AOJu0YyCOJh4DQyRa2HN4oSY2zCW5Ov+LuKsUgRAkhwGxtARHp7iH8G9 k23LWMr85wvCQLtHYiwv6zpoeJKwLNepfIvLiypNDxVqFJbKLhs2oPSrVlMfeb2m+dAphMX4QoU ri9m/dmK2wsyFeBxSRna/MaTcaQU5czQ= X-Gm-Gg: ATEYQzwukngphw2NTAXqSzgGat81EDDwoke418fjV78UutU1TbPH/tRIhR8+BcXyyzX TdbrDpkcCvqRS7czTZQQ7xfeciNEFHbnE3mr05Rgq+Y6tZfVfvnpboqX5rGMnNrBFDBoh6XhxKu /TLC0wChSLs+PSjWfiSE6fkM0W5HbxyrFBDWkjPLuAMAS7nL24G4vDSnsucSuJJ1zWpZcBYfhcm qb4i0bg+dHXzCaJnqSLmdFqzsVRm9sYW1Z8RoubU0E+8s/7VTya7gyYbv1q8nz+ZXnIhRnPciN5 zJ0IE6FIm9u/iB5AcDrtGPBSudvhSvXrmfCMEcqwJr5nNYUm3o1Ei82BujjkOLekDi3NbPfL0DV 9qYsOzXEFiCCqxzamxcuj1yOC7654QYTy09KdA8CHFGsyeKqdyr21+97NLQ== X-Received: by 2002:a05:690e:e8c:b0:649:c6d4:898a with SMTP id 956f58d0204a3-64d656d3e54mr4793425d50.28.1773298856203; Thu, 12 Mar 2026 00:00:56 -0700 (PDT) MIME-Version: 1.0 References: <4166.1773289811@sss.pgh.pa.us> In-Reply-To: <4166.1773289811@sss.pgh.pa.us> From: Pavel Stehule Date: Thu, 12 Mar 2026 08:00:19 +0100 X-Gm-Features: AaiRm52tifCaB8Nv484cLFfqjacL-1ZNdd92qmlMxeZr4-KxvNIzQrwSjr-_qEI Message-ID: Subject: Re: POC: PLpgSQL FOREACH IN JSON ARRAY To: Tom Lane Cc: Peter Eisentraut , PostgreSQL Hackers Content-Type: multipart/alternative; boundary="000000000000679d38064cce5042" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000679d38064cce5042 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi =C4=8Dt 12. 3. 2026 v 5:30 odes=C3=ADlatel Tom Lane nap= sal: > Peter Eisentraut writes: > > Maybe this could be written in such a way that it doesn't hardcode JSON > > arrays specifically, but a type could have an iteration helper function > > that would feed this feature? > > +1. ISTM that this feature would make sense for subscriptable types, > so one way to shoehorn it into the system without a lot of new overhead > could be to extend struct SubscriptRoutines to offer optional support > function(s) for iterating through all the elements of a subscriptable > object. > I'll try to write second patch in this way Regards Pavel > > regards, tom lane > --000000000000679d38064cce5042 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

=C4=8Dt 12. 3. 2026 v=C2=A05:= 30 odes=C3=ADlatel Tom Lane <tgl@ss= s.pgh.pa.us> napsal:
Peter Eisentraut <peter@eisentraut.org> writes:
> Maybe this could be written in such a way that it doesn't hardcode= JSON
> arrays specifically, but a type could have an iteration helper functio= n
> that would feed this feature?

+1.=C2=A0 ISTM that this feature would make sense for subscriptable types,<= br> so one way to shoehorn it into the system without a lot of new overhead
could be to extend struct SubscriptRoutines to offer optional support
function(s) for iterating through all the elements of a subscriptable
object.

I'll try to write second patch in this way

Regards

Pavel
=
=C2=A0

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 regards, tom lane
--000000000000679d38064cce5042--