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 1urq0r-00DGBk-2o for pgsql-hackers@arkaria.postgresql.org; Fri, 29 Aug 2025 03:42:54 +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 1urq0q-006BP9-Eo for pgsql-hackers@arkaria.postgresql.org; Fri, 29 Aug 2025 03:42:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1urq0q-006BP1-1H for pgsql-hackers@lists.postgresql.org; Fri, 29 Aug 2025 03:42:52 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1urq0n-002IHX-0n for pgsql-hackers@postgresql.org; Fri, 29 Aug 2025 03:42:51 +0000 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-76e4fc419a9so1788152b3a.0 for ; Thu, 28 Aug 2025 20:42:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756438969; x=1757043769; 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=eiCi6sZjr4Vp0IWQhSkhRQ2zSgexr6W6nuHWWDvCOG4=; b=cZwnG1OW2ihRJ6/uB2SERV4DtTcACNvs6PqtFMqEGi0onwLMvxUfx5HAq9vv9SJB1z 7WfpPFS03A47Drh0hFzsFOecz6QpE/yQYgomyLIugLizbT5qTucdwAwYdZn1Wh6GvK6H RgXK/UC1ZX95sQ9ABnTpJxU2dJN4oicq1HurZIFQBU2jcTP429gJgSHpnsItJSGTRNfk H4QLUUG5P4+/T6f42SQoK4jX44dypUCbJXK/VfsjxFghXyW+OSRdsykGraWMKzH9w5cj d2npqafD2iK5zsoJSSVIMwryNWXLno4TITrLvVIfWL9xW+wVtAuN3/3uy8Ox70ZHUeg+ hrjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756438969; x=1757043769; 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=eiCi6sZjr4Vp0IWQhSkhRQ2zSgexr6W6nuHWWDvCOG4=; b=xBFUD4tNxRPJSNDFlouhrI7nAJ6/Pune1meD6HKU5SVnwB2c+UZHQpKspkhgZN+DBw C/pnMrL32u8bBh8DUSAH1tPe+LvC/HcZRDMRY11Ghjeyt4++bRVG9Y4gBijD5O8yFz/o J1BSAF0uEpglPlUaHV4qO+HIuDhFUyLLfs3jAS9UfoV5KIIv3vTgRg+D8n4UOUHdv6AP QRuOucf9fsOIWweKxabyaklLM15YW4ahSj3j4EjzSFnLn69OTBIrwnYPE5oCJUr9GiNm hyl9AnD/NHteh0bwLSj7rHrX2zPU+oUb37b+ty3gt5+40od8gtjenNsCJqnKt7jb5FD8 REBQ== X-Forwarded-Encrypted: i=1; AJvYcCWYaNQLkSa/04PFS0/4kfcVAKaIkCnb6mwJdig8Smh4K30wbMJI3eWR4ndxLIfRBNi7fBE0mOR+Hd+BOiBY@postgresql.org X-Gm-Message-State: AOJu0YxyccfOnP7zUoV/N0lsan4YkFu1zi5hKO4jz5S5nI4XL2r2Tvy8 +UC3GISgCQFyXcGXXkQgZ+d2jS2P9SEmoath5fNPeTmKIfVPxodUP408 X-Gm-Gg: ASbGncvTG1Z/+bUlhB7vrFvzyjMFHgabcSWYZOeloF9Vi6a/noXLD6FPSCOsdIpGLur fHmuKZFfzWoVuwBesKfjyB5Dr1Pfq5VXHtkiKGfsnhhFf+T3uCMCubTyff91Vtx3nfazFwM+y9/ Rx2Rpw94mEY+neNKcqzHs1vlTj9ZD0F2gnEA595GxuZb9nNjcc9IBIDVuv2ssB1zWUjAgDEkXgQ jc/vw9XPBZJ0XZxIwF4pHDsd3rs5XRZia21J/50n9EZdvFVFJkUHwcIekNeFD7+VKvDO7390WoL MUMrqbifzvMH1u/jUr4DjILPO3s2m0CnBzCrWM4lK9AOCoyTJ8d/ImTWFK3XzIhOGtRNELa3jA0 B18v26kz+IaZL9SCYWc8G0LaeOLLO1Gqk X-Google-Smtp-Source: AGHT+IGkRnJHgcnAQTChXjmWwMJ93N1wUDVTkei3SSbGvANd8lJuvNp2UjAXzIzEW4II/LxBw5aGJA== X-Received: by 2002:a05:6a00:91a9:b0:772:24bf:1f7d with SMTP id d2e1a72fcca58-77224bf219amr4388311b3a.2.1756438968877; Thu, 28 Aug 2025 20:42:48 -0700 (PDT) Received: from smtpclient.apple ([142.171.105.12]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-772306a1870sm131847b3a.75.2025.08.28.20.42.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Aug 2025 20:42:48 -0700 (PDT) From: Chao Li Message-Id: <3EF2F248-1881-4764-96D7-CC0957AC68F7@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_E499A277-B31F-4FBB-A29B-55313104CB31" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: SQL:2023 JSON simplified accessor support Date: Fri, 29 Aug 2025 11:42:31 +0800 In-Reply-To: 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> 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=_E499A277-B31F-4FBB-A29B-55313104CB31 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 >=20 > Best, > Alex > = I am trying to split different topics to different email to keep every = issue to be focused. I also have a suggestion. If I do: ``` =E2=80=94 s1 select (t.data)['con']['a'][1]['b']['c']['d'] from test_jsonb_types t; =E2=80=94s2 select (t.data).con.a[1].b['c'].d from test_jsonb_types t; ``` The two statements are actually identical. But they generate quite = different rewritten query trees. S1=E2=80=99s rewritten tree is much = simpler than s2=E2=80=99s. However, their plan trees are the same. I think we can convert string indirections to indices indirection first = before transform indirections, so that the two SQLs will generate the = same rewritten query tree, which would simplify the code logic of = rewriting query tree and the planner. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/ --Apple-Mail=_E499A277-B31F-4FBB-A29B-55313104CB31 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

Best,
Alex
<v14-0002-Allow-Generic-Type-Subscripting-to-Acc= ept-Dot-No.patch><v14-0003-Export-jsonPathFromParseResult.patch&g= t;<v14-0001-Allow-transformation-of-only-a-sublist= -of-subscr.patch><v14-0005-Implement-read-only-dot-notation-for-j= sonb.patch><v14-0007-Implement-jsonb-wildcard-member-access= or.patch><v14-0006-Implement-Jsonb-subscripting-with-slic= ing.patch><v14-0004-Extract-coerce_jsonpath_subscript.patc= h>

I am trying to = split different topics to different email to keep every issue to be = focused.

I also have a = suggestion.

If I = do:

```
=E2=80=94 s1
select = (t.data)['con']['a'][1]['b']['c']['d'] from test_jsonb_types = t;

=E2=80=94s2
select = (t.data).con.a[1].b['c'].d from test_jsonb_types = t;
```

The two statements are = actually identical. But they generate quite different rewritten query = trees. S1=E2=80=99s rewritten tree is much simpler than s2=E2=80=99s. = However, their plan trees are the same.

I think = we can convert string indirections to indices indirection first before = transform indirections, so that the two SQLs will generate the same = rewritten query tree, which would simplify the code logic of rewriting = query tree and the planner.


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




= --Apple-Mail=_E499A277-B31F-4FBB-A29B-55313104CB31--