public inbox for [email protected]
help / color / mirror / Atom feedFrom: jian he <[email protected]>
To: Alexandra Wang <[email protected]>
Cc: Nikita Malakhov <[email protected]>
Cc: Vik Fearing <[email protected]>
Cc: Mark Dilger <[email protected]>
Cc: Matheus Alcantara <[email protected]>
Cc: Peter Eisentraut <[email protected]>
Cc: Andrew Dunstan <[email protected]>
Cc: Nikita Glukhov <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Cc: David E. Wheeler <[email protected]>
Subject: Re: SQL:2023 JSON simplified accessor support
Date: Wed, 27 Aug 2025 12:15:06 +0800
Message-ID: <CACJufxFg0Li_skG2NCFg=EneaqhnPBrVDLeAm6yVFWkdoY3y5w@mail.gmail.com> (raw)
In-Reply-To: <CAK98qZ35eF+9MZuqR4HNrmebyBFdNiNLiLZHpQPB7S7OUk-DDQ@mail.gmail.com>
References: <[email protected]>
<[email protected]>
<CAK98qZ2QGcyJrJAFv9wjY6S8yP9dUVnmG9Gb4OXuzuMMuM1Z5Q@mail.gmail.com>
<[email protected]>
<[email protected]>
<CAK98qZ3Ly6PhRwCVmMKJBba5oHVF9k370MMT2b_gep-SuQfRtg@mail.gmail.com>
<CAK98qZ1za8XgOLY+2hQMPGoxVYFyh=dDkM2dZPVeJK4J6poyvA@mail.gmail.com>
<CAK98qZ0EfrPcv3ZwGdeDiLPEpXYfHOEc8S2D=OCPJGcyWy5d-g@mail.gmail.com>
<CAK98qZ1rZaVNy6ViangQom4iinZVH7=ebqhTsPxMQbN5ZtE9XQ@mail.gmail.com>
<CAFY6G8cY5SUG5L-0ryVpom6HynE49p8-XQ59qkaEgnZZJ-c4Rg@mail.gmail.com>
<CAFY6G8eUGcU3A4AHprgYbSOAOj7+WGhGxS_YP0wd2+aCpZTiNg@mail.gmail.com>
<CAK98qZ14uKKRVFg4ibzMfReYaZD6Byxq8nYnvNNtXNjCfcd8kQ@mail.gmail.com>
<CAHgHdKtL9nNaKXGCLt9gWugVzYWKhoBDQ7NESUwdCBty8kFK-A@mail.gmail.com>
<CAK98qZ1nz6ZZhQqTOCNwRguZE5GsBLW5BQT_k=s7AA6gc2CN_g@mail.gmail.com>
<[email protected]>
<CAN-LCVM6A9z6AzxsEX-vx9=3XgEUU6+zjUqejQw8LfjaRY5P1A@mail.gmail.com>
<CAK98qZ2Pmf6ZSChLq+CEPKJ_8jSa0gFTNJWJTcWbCziDpqa=CA@mail.gmail.com>
<CACJufxEt5bL-xYojenA7x1Fq=-DfhW3KGH=3Zz9TjJ1k95=uuQ@mail.gmail.com>
<CAK98qZ0whQ=c+JGXbGSEBxCtLgy6sf-YGYqsKTAGsS-wt0wj+A@mail.gmail.com>
<CACJufxHqiKbh1RN4-rquYdnS8qK9kEQq=bpt6ED_yo1+OkU8jg@mail.gmail.com>
<CAK98qZ19bC=Qw9rWGOFKyX4B-fg1XQWEbV2OWAawqWC62fx79A@mail.gmail.com>
<CACJufxGW0Uq2Xx2NLexYR410pvLx2+QKBvBjgM+5qHsqvT5BFQ@mail.gmail.com>
<CAK98qZ3CvSfKS5yV3FAtOpWhbWHkB5aFWrngV_wYnwUbmHF4SQ@mail.gmail.com>
<CACJufxG34m9BGnfD9RD5OEohkV3Oh-+7Xf=3epXyHfQj4DPiOw@mail.gmail.com>
<CAK98qZ35eF+9MZuqR4HNrmebyBFdNiNLiLZHpQPB7S7OUk-DDQ@mail.gmail.com>
On Tue, Aug 26, 2025 at 11:53 AM Alexandra Wang
<[email protected]> 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_jsonpath() examined the first indirection
* element but could not turn it into a JsonPath component (for example,
* ['a']).
"""
CREATE TABLE ts2 AS SELECT '{"a": "b"}' ::jsonb jb;
SELECT (jb)['a'] FROM ts2;
SELECT (jb).a['a'] FROM ts2;
in these two cases, ['a'], it won't reach jsonb_subscript_make_jsonpath,
because jsonb_check_jsonpath_needed will return false.
maybe I am missing something,
for the above point b, can you use some SQL example to explain it?
make_jsonpath_item_expr(ParseState *pstate, Node *expr, List **exprs)
if expr satisfies the condition, then append the transformed expr to List exprs
if not returns NULL.
The list append logic is within make_jsonpath_item_int.
seems not that intuitive (another level of indirection)
maybe we don't need make_jsonpath_item_int.
Another reason would be in make_jsonpath_item_int it's not easy found
out that exprs actually refers to SubscriptingRef->refupperindexpr
also v14-0006-Implement-Jsonb-subscripting-with-slicing.patch also doesn't use
make_jsonpath_item_int that much frequently.
--------------------------------
in v14-0005-Implement-read-only-dot-notation-for-jsonb.patch
+ * In addition to building the JsonPath expression, this function populates
+ * the following fields of the given SubscriptingRef:
+ * - refjsonbpath: the generated JsonPath
+ * - refupperindexpr: upper index expressions (object keys or array indexes)
+ * - reflowerindexpr: lower index expressions, remains NIL as slices
are not yet supported.
"reflowerindexpr" changed in v14-0006, so "reflowerindexpr" comments
in v14-0006 need to change.
but "reflowerindexpr" we didn't touch in v14-0005, so the
"reflowerindexpr" comments look weird.
+SELECT (jb).a['b'] FROM test_jsonb_dot_notation; -- returns NULL due
to strict mode
we can not specify strict just like, ``select 'strict $'::jsonpath;``
all the patches in here are default to lax mode.
so I am confused by this comment. ("strict mode").
view thread (68+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: SQL:2023 JSON simplified accessor support
In-Reply-To: <CACJufxFg0Li_skG2NCFg=EneaqhnPBrVDLeAm6yVFWkdoY3y5w@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox