Re: SQL:2023 JSON simplified accessor support

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Alexandra Wang <alexandra(dot)wang(dot)oss(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Nikita Glukhov <glukhov(dot)n(dot)a(at)gmail(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>, Nikita Malakhov <hukutoc(at)gmail(dot)com>, Vik Fearing <vik(at)postgresfriends(dot)org>, Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>, Matheus Alcantara <matheusssilv97(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>, "David E(dot) Wheeler" <david(at)justatheory(dot)com>
Subject: Re: SQL:2023 JSON simplified accessor support
Date: 2025-09-24 06:37:43
Message-ID: F24FAB6F-63D1-4F7D-83C9-09E76B561E11@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Sep 24, 2025, at 09:05, Alexandra Wang <alexandra(dot)wang(dot)oss(at)gmail(dot)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/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2025-09-24 06:42:04 Re: Report bytes and transactions actually sent downtream
Previous Message Shubham Khanna 2025-09-24 06:37:38 Re: Add support for specifying tables in pg_createsubscriber.