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 1utH2x-003vdc-3Y for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Sep 2025 02:47:00 +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 1utH2w-001f0H-Af for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Sep 2025 02:46:58 +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 1utH2w-001f09-0Y for pgsql-hackers@lists.postgresql.org; Tue, 02 Sep 2025 02:46:58 +0000 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1utH2s-0006PS-2i for pgsql-hackers@postgresql.org; Tue, 02 Sep 2025 02:46:58 +0000 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-7704f3c46ceso4092347b3a.2 for ; Mon, 01 Sep 2025 19:46:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756781214; x=1757386014; darn=postgresql.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=NKWU5OmF8Y+jaQE7adTIH7B3imkeegpICUJl+vPifmY=; b=W5ODAhNZyBnWioMH120YMdO/OlNoF9L8gG7aPN0Usy1MAMXd/z37KQex0m++ZJVltt +5biH0faj7I3cyq9uBO/1VMfWXA6miUeLBxFBCYAAKE0k0lsMA3oc4Vaoh5xHkjAmC16 tNoYBtY4MmdoqOzbdvEWXrCq0dpOIJQsWKqEfZIG6eRmJHyWO8lZIBOSwsrOIYizcX0P J8EeRFZGNdgSUIlw+J/+WIs13xQ4/EAvuCqJ0HAnEbJH/fhiA8gikVi7gMSD4z5i1I/Q Z6ja3n2P71xWpgN3CgVJw48wszXOle6GxPmOvFyZKuV6j10wsZEP6fHJARlslWjAfL1g DDCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756781214; x=1757386014; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NKWU5OmF8Y+jaQE7adTIH7B3imkeegpICUJl+vPifmY=; b=wCX3eA0ahbCw8/8PH83ZiAoIkWEH3ieKeAzz/quvh0WTdLlsvwlFk65rJAgQMPhh4x uiwm/2u1gKok+oHI4MF1Cnj39Up3D62exHqF5FuH7qDFx/yNhznLmx13Dt+jmPfmIWUd +vpOfFw/lIhpZ2lpgy5mddLQTDvE6NopjuptG5K5BD4+xdFG+mPafuZRuSb6xJH5cKZM a3hF997uzVpHOHI6VS128WLf3xKvEGNrn0p7Rnaa+YivS3sDpTwsV0yS8va9VmRpidbN 3HAPXv4CF5bTCbWB36QAjHzvCMneWr2Ojg7k96/pTvrn7iS3MuIau0+GUl0lAKtyLIKQ tk3g== X-Forwarded-Encrypted: i=1; AJvYcCVN/gc/Dql+m0MatR5Vmj2ZW+iQVeAY4hYXerEYiKxDlXpeyQA29I0sVUI2F/gvyGoJa3FFmXKaLF78mX4K@postgresql.org X-Gm-Message-State: AOJu0Ywg6jHZqHQkCfxjAakBB3JmyhqGoEjb+fY2Nt9hjoqCTqwb81I2 aGPFdhRi5271yjb5b0T27pKOEHtWRqq2NCwL95r6Z4YNIdXPgVKbzI8K X-Gm-Gg: ASbGncv9qCyKE1XooG47nPn/OKrl0+JL/FxQLJbit40/dLsZLE610UUF4gkFpUPCAcM iFIXAmngINcJISKZI/7/Bk8PPWtXE1IksIr56qyKneSIWLPhyxbHtA+AXi3lfFO/5N9XhxSYwAA P+qzq8rH7y5XMPgyh2GfVzcxrLwUh6UpFBQPfyyev4oYmhciT4prOlNAZ7sr23h5XavoTh0nxD/ PTqKxJhYgep4gJDM8fDMpR8E9c8vqAsug7hJmSqDXs/UYL0ofcKzhgkLiNsljijdrDysP9wL/z+ Kxo0YyHlneH8uDxdnGi+5Vd1C2IBcinjED+haXNAuSJEE1M6+zwHWGju0JSfyTukulUy3ffnww6 gZqgO/+xzPoVeqv9wos3cJjZRyXAvgBWwPuO1KsLLybA= X-Google-Smtp-Source: AGHT+IH7p0LmdkFoEJKED1U61YJvD3SAejUTPpZ8/um2WbmWTULr8P/FZspth0S+w7ByMmjkvwaCxg== X-Received: by 2002:a05:6a21:3396:b0:243:c217:512e with SMTP id adf61e73a8af0-243d6dd1431mr13532563637.7.1756781213511; Mon, 01 Sep 2025 19:46:53 -0700 (PDT) Received: from smtpclient.apple ([142.171.105.12]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-329b4ef032asm3667686a91.13.2025.09.01.19.46.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Sep 2025 19:46:52 -0700 (PDT) From: Chao Li Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_092EB990-E61B-461B-BCEF-1968B823DDDC" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: SQL:2023 JSON simplified accessor support Date: Tue, 2 Sep 2025 10:46:35 +0800 In-Reply-To: <263CAF0D-7776-4349-93CA-CC1AB15384CA@gmail.com> Cc: jian he , Nikita Malakhov , Vik Fearing , Mark Dilger , Matheus Alcantara , Peter Eisentraut , Andrew Dunstan , Nikita Glukhov , PostgreSQL Hackers , "David E. Wheeler" To: Alexandra Wang References: <21fa36b4-6d56-4556-b524-9e3955b922c8@eisentraut.org> <263CAF0D-7776-4349-93CA-CC1AB15384CA@gmail.com> X-Mailer: Apple Mail (2.3826.700.81) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_092EB990-E61B-461B-BCEF-1968B823DDDC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Aug 27, 2025, at 15:26, Chao Li wrote: >=20 > diff --git a/src/include/parser/parse_node.h = b/src/include/parser/parse_node.h > index f7d07c84542..58a4b9df157 100644 > --- a/src/include/parser/parse_node.h > +++ b/src/include/parser/parse_node.h > @@ -361,7 +361,7 @@ extern SubscriptingRef = *transformContainerSubscripts(ParseState *pstate, > = Node *containerBase, > = Oid containerType, > = int32 containerTypMod, > - = List *indirection, > + = List **indirection, > = bool isAssignment); >=20 > Here we change =E2=80=9Cindirection=E2=80=9D from * to **, I guess the = reason is to indicate if the indirection list is fully processed. In = case of fully processed, set it to NULL, then caller gets NULL via **. >=20 > As =E2=80=9Cindirection=E2=80=9D is of type =E2=80=9CList *=E2=80=9D, = can we just set =E2=80=9Cindirection->length =3D 0=E2=80=9D? I checked = pg_list.h, there is not a function or macro to cleanup a list (free = elements and reset length to 0). There is a =E2=80=9Clist_free(List = *list)=E2=80=9D, but it will free =E2=80=9Clist=E2=80=9D itself as well. = Maybe we can add a new function, say =E2=80=9Clist_reset(List *list)=E2=80= =9D or =E2=80=9Clist_cleanup(List *list)=E2=80=9D. This way will keep = the function interface unchanged, and less changes would be involved. After revisiting the changes, I take back this comment. Given the nature = that List are always used in pointer form, my comment would just make = things much more complicated. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/ --Apple-Mail=_092EB990-E61B-461B-BCEF-1968B823DDDC Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Aug 27, 2025, at 15:26, Chao Li = <li.evan.chao@gmail.com> wrote:

diff --git = a/src/include/parser/parse_node.h = b/src/include/parser/parse_node.h
index = f7d07c84542..58a4b9df157 100644
--- = a/src/include/parser/parse_node.h
+++ = b/src/include/parser/parse_node.h
@@ -361,7 +361,7 @@ extern = SubscriptingRef *transformContainerSubscripts(ParseState = *pstate,
              =                     =                     =                     =                     =            Node = *containerBase,
            =                     =                     =                     =                     =              Oid = containerType,
            =                     =                     =                     =                     =              int32 = containerTypMod,
-             =                     =                     =                     =                     =            List *indirection,
+ =                     =                     =                     =                     =                     =    List **indirection,
        =                     =                     =                     =                     =                  bool = isAssignment);

Here we change =E2=80=9Cindirection=E2=80=9D = from * to **, I guess the reason is to indicate if the indirection list = is fully processed. In case of fully processed, set it to NULL, then = caller gets NULL via **.

As =E2=80=9Cindirection=E2=80=9D is of type = =E2=80=9CList *=E2=80=9D, can we just set =E2=80=9Cindirection->length = =3D 0=E2=80=9D? I checked pg_list.h, there is not a function or macro to = cleanup a list (free elements and reset length to 0). There is a = =E2=80=9Clist_free(List *list)=E2=80=9D, but it will free =E2=80=9Clist=E2= =80=9D itself as well. Maybe we can add a new function, say = =E2=80=9Clist_reset(List *list)=E2=80=9D or =E2=80=9Clist_cleanup(List = *list)=E2=80=9D. This way will keep the function interface unchanged, = and less changes would be = involved.

After = revisiting the changes, I take back this comment. Given the nature that = List are always used in pointer form, my comment would just make things = much more complicated.

Best regards,
--
Chao Li (Evan)
HighGo Software = Co., Ltd.
https://www.highgo.com/




= --Apple-Mail=_092EB990-E61B-461B-BCEF-1968B823DDDC--