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

SQL:2023 JSON simplified accessor support

2024-08-29 Thread Alexandra Wang
Hello Hackers, I’ve attached a patch to start adding SQL:2023 JSON simplified accessor support. This allows accessing JSON or JSONB fields using dot notation (e.g., colname.field.field...), similar to composite types. Currently, PostgreSQL uses nonstandard syntax like colname->x->y for JS