On Wed, Jun 25, 2025 at 1:56 PM jian he <jian.universal...@gmail.com> 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 test_jsonb_dot_notation;
CREATE VIEW v2 AS SELECT (jb).a[3:].x.y[:-1] FROM test_jsonb_dot_notation;
CREATE VIEW v3 AS SELECT (jb).a[:3].x.y[-1:] FROM test_jsonb_dot_notation;

\sv v2
\sv v3
will trigger segment fault.

also do we need ban subscript slicing, when upper bound is less than
lower bound,
for example:
SELECT (jb).a[3:].x.y[0:'-1'::integer] AS y FROM test_jsonb_dot_notation;

please check the attached minor refactoring, which addresses the above issue
based on patches v11-0001 through v11-0006.

Attachment: v11-0001-misc-refactoring-SubscriptingRef-deparsing.no-cfbot
Description: Binary data

Reply via email to