Hi Andrey,
Thanks, v2 looks good to me.
On master (d637007e62a) it applies, builds without warnings and passes
make check. Six of the nine new tests fail without the code change.
The {a,-3} one passes on master too, as it should, since it covers the
case v1 got wrong.
I compared json #>, #>> and json_extract_path with jsonb on 55 paths:
the 30 from before, plus 25 with duplicate keys at different levels,
three copies of a key, and arrays and negative indexes under a
duplicate key. With v2 all of them match jsonb. Master differs on 15
of the 25.
v2 applies to REL_19_STABLE. 18 and older need their own version
because of palloc_array().
I think this is ready for a committer.
Regards,
Ishjaap Singh