Re: SQL:2023 JSON simplified accessor support

2025-09-02 Thread Chao Li
> On Sep 2, 2025, at 11:53, David G. Johnston > wrote: > > On Monday, September 1, 2025, Chao Li > wrote: >> >> The last comment is about error message: >> >> ``` >> evantest=# select data.a from test_jsonb_types; >> ERROR: missing FROM-clause entry for table

Re: SQL:2023 JSON simplified accessor support

2025-09-01 Thread David G. Johnston
On Monday, September 1, 2025, Chao Li wrote: > > The last comment is about error message: > > ``` > evantest=# select data.a from test_jsonb_types; > ERROR: missing FROM-clause entry for table "data" > LINE 1: select data.a from test_jsonb_types; > ``` > > “Missing FROM-clause entry” is quite co

Re: SQL:2023 JSON simplified accessor support

2025-09-01 Thread Chao Li
> On Aug 27, 2025, at 15:26, Chao Li 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 >

Re: SQL:2023 JSON simplified accessor support

2025-09-01 Thread Chao Li
Hi Alex, Thank you so much for such a detailed explanation. > On Aug 30, 2025, at 08:53, Alexandra Wang > wrote: > > > > I hope this long explanation helps! > > [1] > https://www.postgresql.org/docs/current/functions-json.html#SQLJSON-QUERY-FUNCTIONS > > I used to only use the “->” and

Re: SQL:2023 JSON simplified accessor support

2025-08-31 Thread Alexandra Wang
Hi Chao, On Thu, Aug 28, 2025 at 8:42 PM Chao Li wrote: > I am trying to split different topics to different email to keep every > issue to be focused. > Sure! On Thu, Aug 28, 2025 at 8:42 PM Chao Li wrote: > I also have a suggestion. > > If I do: > > ``` > — s1 > select (t.data)['con']['a']

Re: SQL:2023 JSON simplified accessor support

2025-08-29 Thread Alexandra Wang
Hi Chao, Thanks for reviewing! On Thu, Aug 28, 2025 at 8:29 PM Chao Li wrote: > > On Aug 26, 2025, at 11:52, Alexandra Wang > wrote: > > Best, > Alex > > > > > > > > > > > I found a bug. > ``` > INSERT INTO test_jsonb_types (data) VALUES > ('[1, 2, "three"]'), > ('{"con": {"a": [{"b": {

Re: SQL:2023 JSON simplified accessor support

2025-08-29 Thread Chao Li
> On Aug 26, 2025, at 11:52, Alexandra Wang > wrote: > A few other comments: -static Node * -transformIndirection(ParseState *pstate, A_Indirection *ind) +Node * +transformIndirection(ParseState *pstate, A_Indirection *ind, +bool *trailing_star_expan

Re: SQL:2023 JSON simplified accessor support

2025-08-28 Thread Chao Li
> > 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: ``` — s1 select (t.data)['con']['a'][1]['b']['c']['d'] from test_jsonb_types t; —s2 select (t.data).con.a[1].b['c'].d from test_jsonb_types t; `

Re: SQL:2023 JSON simplified accessor support

2025-08-28 Thread Chao Li
>> On Aug 26, 2025, at 11:52, Alexandra Wang >> wrote: >> >> Best, >> Alex >> > > I found a bug. ``` INSERT INTO test_jsonb_types (data) VALUES ('[1, 2, "three"]'), ('{"con": {"a": [{"b": {"c": {"d": 99}}}, {"b": {"c": {"d": 100}}}]}}’); ``` If I use a index following a slice, it doesn’t

Re: SQL:2023 JSON simplified accessor support

2025-08-27 Thread Chao Li
> On Aug 26, 2025, at 11:52, Alexandra Wang > wrote: > > Best, > Alex > I just started with 0001, I just got a comment: 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/inclu

Re: SQL:2023 JSON simplified accessor support

2025-08-26 Thread jian he
On Tue, Aug 26, 2025 at 11:53 AM Alexandra Wang wrote: > > Hi Jian, > > I’ve attached v14, which includes only indentation and comment changes > from v13. > hi. still reviewing v14-0001 to v14-0005. I am confused by the comments in jsonb_subscript_transform "" * (b) jsonb_subscript_make_jso

Re: SQL:2023 JSON simplified accessor support

2025-08-25 Thread jian he
On Sat, Aug 23, 2025 at 3:34 AM Alexandra Wang wrote: > > I don’t understand the question. In the case of an unsupported Node > type (not an Indices in patch 0001 or 0002), we break out of the loop > to stop transforming the remaining subscripts. So there won’t be any > ‘not contiguous’ indirectio

Re: SQL:2023 JSON simplified accessor support

2025-08-22 Thread Alexandra Wang
Hi Jian, On Fri, Aug 22, 2025 at 1:20 AM jian he wrote: > On Thu, Aug 21, 2025 at 12:54 PM Alexandra Wang > wrote: > > > > Hi Jian, > > > > Thanks for reviewing! I’ve attached v13, which addresses your > > feedback. > > > > hi. > in the context of v13-0001 and v13-0002. > > In transformIndirect

Re: SQL:2023 JSON simplified accessor support

2025-08-22 Thread jian he
On Thu, Aug 21, 2025 at 12:54 PM Alexandra Wang wrote: > > Hi Jian, > > Thanks for reviewing! I’ve attached v13, which addresses your > feedback. > hi. in the context of v13-0001 and v13-0002. In transformIndirection: while (subscripts) { Node *newresult = (Node *) = transformContainer

Re: SQL:2023 JSON simplified accessor support

2025-07-10 Thread jian he
On Thu, Jul 10, 2025 at 9:34 PM jian he wrote: > > -- > in jsonb_subscript_make_jsonpath we have > foreach(lc, *indirection) > { > if (IsA(accessor, String)) > > else if (IsA(accessor, A_Indices)) > else >

Re: SQL:2023 JSON simplified accessor support

2025-07-10 Thread jian he
On Thu, Jul 10, 2025 at 4:53 PM jian he wrote: > > src7=# select ('{"a": 1, "b": "c", "d": [1, 2, 3]}'::jsonb).d['1'::int8]; > WARNING: mixed usage of jsonb simplified accessor syntax and jsonb > subscripting. > LINE 1: ...t ('{"a": 1, "b": "c", "d": [1, 2, 3]}'::jsonb).d['1'::int8]... >

Re: SQL:2023 JSON simplified accessor support

2025-07-10 Thread jian he
On Wed, Jul 9, 2025 at 4:02 PM Alexandra Wang wrote: > > Thanks again for the patch! It was really helpful! I didn't directly > apply it as I made a few different choices, but I think I have > addressed all the points you covered in it. > > Let me know your thoughts! > hi. in v12-0001 and v12-00

Re: SQL:2023 JSON simplified accessor support

2025-07-09 Thread Alexandra Wang
Hi Jelte, On Sat, Jun 28, 2025 at 4:52 PM Jelte Fennema-Nio wrote: > On Thu, 13 Mar 2025 at 15:02, Alexandra Wang > wrote: > > I have attached the new patches. > > Okay I finally found the time to look at this. I created a draft PR > for pg_duckdb[1] to see if I would run into issues. There was

Re: SQL:2023 JSON simplified accessor support

2025-06-28 Thread Jelte Fennema-Nio
On Thu, 13 Mar 2025 at 15:02, Alexandra Wang wrote: > I have attached the new patches. Okay I finally found the time to look at this. I created a draft PR for pg_duckdb[1] to see if I would run into issues. There was only one real issue I found by doing this. The .* syntax is encoded as NULL in r

Re: SQL:2023 JSON simplified accessor support

2025-06-26 Thread jian he
hi. in gram.y we have: indirection_el: '.' attr_name { $$ = (Node *) makeString($2); } we can be sure that dot notation, following dot is a plain string. then in jsonb_subscript_transform, we can transform the String Node to a TEXTOI

Re: SQL:2023 JSON simplified accessor support

2025-06-25 Thread jian he
On Wed, Jun 25, 2025 at 1:56 PM jian he wrote: > > hi. CREATE TABLE test_jsonb_dot_notation AS SELECT '{"a": [1, 2, {"b": "c"}, {"b": "d", "e": "f", "x": {"y": "yyy", "z": "zzz"}}], "b": [3, 4, {"b": "g", "x": {"y": "YYY", "z": "ZZZ"}}]}'::jsonb jb; CREATE VIEW v1 AS SELECT (jb).a[3].x.y FROM tes

Re: SQL:2023 JSON simplified accessor support

2025-06-24 Thread jian he
hi. in src/backend/catalog/sql_features.txt should we mark any T860, T861, T862, T863, T864 items as YES? typedef struct SubscriptingRef { /* expressions that evaluate to upper container indexes */ List *refupperindexpr; } SubscriptingRef.refupperindexpr meaning changed, So the abo

Re: SQL:2023 JSON simplified accessor support

2025-06-24 Thread jian he
hi. I have applied for 0001 to 0006. static void jsonb_subscript_transform(SubscriptingRef *sbsref, List **indirection, ParseState *pstate, bool isSlice, bool isAssignment) { List *up

Re: SQL:2023 JSON simplified accessor support

2025-06-23 Thread Alexandra Wang
Hi Nikita, Thank you so much for reviewing! On Wed, Apr 23, 2025 at 6:54 PM Nikita Malakhov wrote: > Hi Alex! > > Glad you made so much effort to develop this patch set! > I think this is an important part of Json functionality. > > I've looked into you patch and noticed change in behavior > in

Re: SQL:2023 JSON simplified accessor support

2025-06-23 Thread Alexandra Wang
Hi Vik, On Thu, Mar 27, 2025 at 3:27 PM Vik Fearing wrote: > > I am reviewing this from a feature perspective and not from a code > perspective. On the whole, this looks good to me from a standards point > of view. > Thank you so much for reviewing! On Thu, Mar 27, 2025 at 3:27 PM Vik Fearing

Re: SQL:2023 JSON simplified accessor support

2025-04-23 Thread Nikita Malakhov
Hi Alex! Glad you made so much effort to develop this patch set! I think this is an important part of Json functionality. I've looked into you patch and noticed change in behavior in new test results: postgres@postgres=# create table t(x int, y jsonb); insert into t select 1, '{"a": 1, "b": 42}'

Re: SQL:2023 JSON simplified accessor support

2025-03-27 Thread Vik Fearing
On 13/03/2025 15:02, Alexandra Wang wrote: Hi Mark, Thank you so much for reviewing! I have attached the new patches. Hi Alex, I am reviewing this from a feature perspective and not from a code perspective.  On the whole, this looks good to me from a standards point of view. There ar

Re: SQL:2023 JSON simplified accessor support

2025-03-20 Thread Peter Eisentraut
This patch set has expanded significantly in scope recently, which is probably the right thing, but that means there won't be enough time to review and finish it for PG18. So I'm moving this to the next commitfest now. On 13.03.25 15:02, Alexandra Wang wrote: Hi Mark, Thank you so much for

Re: SQL:2023 JSON simplified accessor support

2025-03-04 Thread Andrew Dunstan
On 2025-03-04 Tu 10:34 AM, Mark Dilger wrote: On Tue, Mar 4, 2025 at 6:05 AM Mark Dilger wrote: But then I tried: +DO $$ +DECLARE +  a jsonb := '{"": 6, "NU": [{"": [[3]]}, [6], [2], "bCi"], "aaf": [-6, -8]}'::jsonb; +BEGIN +  WHILE a IS NOT NULL +  LOOP

Re: SQL:2023 JSON simplified accessor support

2025-03-04 Thread Mark Dilger
On Tue, Mar 4, 2025 at 6:05 AM Mark Dilger wrote: > But then I tried: > > +DO $$ > +DECLARE > + a jsonb := '{"": 6, "NU": [{"": [[3]]}, [6], [2], "bCi"], "aaf": [-6, > -8]}'::jsonb; > +BEGIN > + WHILE a IS NOT NULL > + LOOP > +RAISE NOTICE '%', a; > +a := COALESCE(a."NU", a[2]); > + E

Re: SQL:2023 JSON simplified accessor support

2025-03-04 Thread Mark Dilger
On Mon, Mar 3, 2025 at 12:23 PM Alexandra Wang wrote: > I've attached v10, which addresses your feedback. > > Hi Alex! Thanks for the patches. In src/test/regress/sql/jsonb.sql, the section marked with "-- slices are not supported" should be relabeled. That comment predates these patches, and

Re: SQL:2023 JSON simplified accessor support

2025-03-03 Thread Alexandra Wang
Hi Matheus, On Mon, Mar 3, 2025 at 1:43 PM Matheus Alcantara wrote: > On Mon, Mar 3, 2025 at 4:16 PM Matheus Alcantara > wrote: > > > > Hi Alex, > > > > The code comments and the commit messages help a lot when reviewing! > Thanks for > > the new version. > > > > The code LGTM and check-world i

Re: SQL:2023 JSON simplified accessor support

2025-03-03 Thread Matheus Alcantara
On Mon, Mar 3, 2025 at 4:16 PM Matheus Alcantara wrote: > > Hi Alex, > > The code comments and the commit messages help a lot when reviewing! Thanks > for > the new version. > > The code LGTM and check-world is happy. I've also performed some tests and > everything looks good! > > Just some minor

Re: SQL:2023 JSON simplified accessor support

2025-03-03 Thread Matheus Alcantara
Hi Alex, The code comments and the commit messages help a lot when reviewing! Thanks for the new version. The code LGTM and check-world is happy. I've also performed some tests and everything looks good! Just some minor points about this new version: ## v9-0005 Typo on commit message title ##

Re: SQL:2023 JSON simplified accessor support

2025-02-27 Thread Alexandra Wang
Hello hackers, On Thu, Feb 27, 2025 at 9:46 AM Alexandra Wang wrote: > Summary of changes: > > v8-0001 through v8-0005: > Refactoring and preparatory steps for the actual implementation. > > v8-0006 (Implement read-only dot notation for JSONB): > I removed the vars field (introduced in v7) from

Re: SQL:2023 JSON simplified accessor support

2025-02-27 Thread Alexandra Wang
Hello hackers, I’ve fixed the compilation failure for hstore and updated the patches. In this version, I’ve further cleaned up the code and added more comments. I hope this helps! Summary of changes: v8-0001 through v8-0005: Refactoring and preparatory steps for the actual implementation. v8-00

Re: SQL:2023 JSON simplified accessor support

2025-02-05 Thread Alexandra Wang
Hi, On Wed, Feb 5, 2025 at 1:20 AM Alexandra Wang wrote: > I attached a minimized version of Nikita’s patch (v7): > > - The first three patches are refactoring steps that could be squashed > if preferred. > - The last two patches implement dot notation and wildcard access, > respectively. >

Re: SQL:2023 JSON simplified accessor support

2025-02-04 Thread Alexandra Wang
Hi hackers, On Tue, Nov 26, 2024 at 3:12 AM Peter Eisentraut wrote: > On 21.11.24 23:46, Andrew Dunstan wrote: > >> Questions: > >> > >> 1. Since Nikita’s patches did not address the JSON data type, and JSON > >> currently does not support subscripting, should we limit the initial > >> feature s

Re: SQL:2023 JSON simplified accessor support

2024-11-26 Thread Peter Eisentraut
On 21.11.24 23:46, Andrew Dunstan wrote: Questions: 1. Since Nikita’s patches did not address the JSON data type, and JSON currently does not support subscripting, should we limit the initial feature set to JSONB dot-notation for now? In other words, if we aim to fully support JSON simplified ac

Re: SQL:2023 JSON simplified accessor support

2024-11-21 Thread Andrew Dunstan
On 2024-11-21 Th 3:52 PM, Alexandra Wang wrote: Hi, On Tue, Nov 19, 2024 at 6:06 PM Nikita Glukhov wrote: Hi, hackers. I have implemented dot notation for jsonb using type subscripting back in April 2023, but failed post it because I left Postgres Professional company soon after and have no

Re: SQL:2023 JSON simplified accessor support

2024-11-21 Thread Alexandra Wang
Hi, On Tue, Nov 19, 2024 at 6:06 PM Nikita Glukhov wrote: > > Hi, hackers. > > I have implemented dot notation for jsonb using type subscripting back > in April 2023, but failed post it because I left Postgres Professional > company soon after and have not worked anywhere since, not even had > an

Re: SQL:2023 JSON simplified accessor support

2024-11-14 Thread Peter Eisentraut
On 07.11.24 22:57, Alexandra Wang wrote: The v5 patch includes the following updates: - Fixed the aforementioned issue and added more tests covering composite types with domains, nested domains, and arrays of domains over JSON/JSONB. - Refactored the logic for parsing JSON/JSONB object fields b

Re: SQL:2023 JSON simplified accessor support

2024-11-07 Thread Alexandra Wang
On Fri, Oct 4, 2024 at 7:33 AM jian he wrote: > > On Thu, Sep 26, 2024 at 11:45 PM Alexandra Wang > wrote: > > > > Hi, > > > > I didn’t run pgindent earlier, so here’s the updated version with the > > correct indentation. Hope this helps! > > > > the attached patch solves the domain type issue, A

Re: SQL:2023 JSON simplified accessor support

2024-10-04 Thread jian he
On Thu, Sep 26, 2024 at 11:45 PM Alexandra Wang wrote: > > Hi, > > I didn’t run pgindent earlier, so here’s the updated version with the > correct indentation. Hope this helps! > the attached patch solves the domain type issue, Andrew mentioned in the thread. I also added a test case: composite

Re: SQL:2023 JSON simplified accessor support

2024-09-27 Thread David E. Wheeler
On Sep 27, 2024, at 12:07, Andrew Dunstan wrote: > That would defeat being able to chain these. Not if it’s a different operator. But I’m fine to just keep using ->> at the end of a chain. D

Re: SQL:2023 JSON simplified accessor support

2024-09-27 Thread Andrew Dunstan
On 2024-09-27 Fr 5:49 AM, David E. Wheeler wrote: On Sep 26, 2024, at 16:45, Alexandra Wang wrote: I didn’t run pgindent earlier, so here’s the updated version with the correct indentation. Hope this helps! Oh, nice! I don’t suppose the standard also has defined an operator equivalent to

Re: SQL:2023 JSON simplified accessor support

2024-09-27 Thread David E. Wheeler
On Sep 26, 2024, at 16:45, Alexandra Wang wrote: > I didn’t run pgindent earlier, so here’s the updated version with the > correct indentation. Hope this helps! Oh, nice! I don’t suppose the standard also has defined an operator equivalent to ->>, though, has it? I tend to want the text output

Re: SQL:2023 JSON simplified accessor support

2024-09-26 Thread Andrew Dunstan
On 2024-09-26 Th 11:45 AM, Alexandra Wang wrote: Hi, I didn’t run pgindent earlier, so here’s the updated version with the correct indentation. Hope this helps! This is a really nice feature, and provides a lot of expressive power for such a small piece of code. I notice this doesn't see

Re: SQL:2023 JSON simplified accessor support

2024-09-26 Thread Alexandra Wang
Hi, I didn’t run pgindent earlier, so here’s the updated version with the correct indentation. Hope this helps! Best, Alex v4-0001-Add-JSON-JSONB-simplified-accessor.patch Description: Binary data

Re: SQL:2023 JSON simplified accessor support

2024-09-23 Thread Alexandra Wang
Hi Peter, Thank you so much for helping! On Mon, Sep 16, 2024 at 12:44 PM Peter Eisentraut wrote: > > On 29.08.24 18:33, Alexandra Wang wrote: > > I’ve implemented the member and array accessors and attached two > > alternative patches: > > > > 1. v1-0001-Add-JSON-JSONB-simplified-accessor.patch

Re: SQL:2023 JSON simplified accessor support

2024-09-16 Thread Peter Eisentraut
On 29.08.24 18:33, Alexandra Wang wrote: I’ve implemented the member and array accessors and attached two alternative patches: 1. v1-0001-Add-JSON-JSONB-simplified-accessor.patch: This patch enables dot access to JSON object fields and subscript access to indexed JSON array elements by convertin