Re: SQL:2023 JSON simplified accessor support
Chao Li <li.evan.chao@gmail.com>
From: Chao Li <li.evan.chao@gmail.com>
To: Alexandra Wang <alexandra.wang.oss@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>,
Nikita Glukhov <glukhov.n.a@gmail.com>,
jian he <jian.universality@gmail.com>,
Nikita Malakhov <hukutoc@gmail.com>,
Vik Fearing <vik@postgresfriends.org>,
Mark Dilger <mark.dilger@enterprisedb.com>,
Matheus Alcantara <matheusssilv97@gmail.com>,
Peter Eisentraut <peter@eisentraut.org>,
Andrew Dunstan <andrew@dunslane.net>,
"David E. Wheeler" <david@justatheory.com>
Date: 2025-09-24T06:37:43Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add test coverage for indirection transformation
- 64492917280a 19 (unreleased) landed
-
Fix typo in comment
- 81a61fde84ff 19 (unreleased) landed
-
Implementation of subscripting for jsonb
- 676887a3b0b8 14.0 cited
> On Sep 24, 2025, at 09:05, Alexandra Wang <alexandra.wang.oss@gmail.com> wrote:
>
> This is the expected behavior for array subscripting, and my patch
> doesn't change that. I don't think this is a problem. With or without
> my patch, you can avoid the ERROR by adding parentheses:
>
> test=# select ((p).meta[1])['a'] from people; meta ------ 30 (1 row)
>
Okay, make sense.
>> 2 - 0002
>> ```
>> + /* Collect leading A_Indices subscripts */
>> + foreach(lc, indirection)
>> + {
>> + Node *n = lfirst(lc);
>> +
>> + if (IsA(n, A_Indices))
>> + {
>> + A_Indices *ai = (A_Indices *) n;
>> +
>> + subscriptlist = lappend(subscriptlist, n);
>> + if (ai->is_slice)
>> + isSlice = true;
>> + }
>> + else
>> + break;
>> ```
>>
>> We can break after “isSlice=true”.
>
> Why? We still want to get the whole prefix list of A_Indices.
Ah, I just realized the main goal of the foreach loop is to build a new “subscrptlist”. In that case, it should not break.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/