Re: SQL:2023 JSON simplified accessor support - Mailing list pgsql-hackers

From Chao Li
Subject Re: SQL:2023 JSON simplified accessor support
Date
Msg-id F24FAB6F-63D1-4F7D-83C9-09E76B561E11@gmail.com
Whole thread Raw
In response to Re: SQL:2023 JSON simplified accessor support  (Alexandra Wang <alexandra.wang.oss@gmail.com>)
List pgsql-hackers


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/




pgsql-hackers by date:

Previous
From: Shubham Khanna
Date:
Subject: Re: Add support for specifying tables in pg_createsubscriber.
Next
From: Bertrand Drouvot
Date:
Subject: Re: Report bytes and transactions actually sent downtream