Re: Patch bug: Fix jsonpath .* on Arrays

David E. Wheeler <david@justatheory.com>

From: "David E. Wheeler" <david@justatheory.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Stepan Neretin <sncfmgg@gmail.com>, Степан Неретин <fenixrnd@mail.ru>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, "David G. Johnston" <david.g.johnston@gmail.com>
Date: 2024-07-19T13:49:50Z
Lists: pgsql-hackers
On Jul 19, 2024, at 01:42, Michael Paquier <michael@paquier.xyz> wrote:

> Sorry for the delay.  Finally came back to it, and applied the tests.
> Thanks!

Awesome, thank you!

> It was fun to see that HEAD was silenced with the first patch of this
> thread that tweaked the behavior with arrays.

Uh, what? Sorry I don’t follow.

> Regarding the comments, I have left them out for now.  That may be a
> good start, but it also feels like we should do a much better job
> overall with the area of jsonpath_exec.c.

I put them in because it took me a bit to track down that they were among the implementors of JsonPathGetVarCallback as I was porting the code.

> One thing that may help as
> a start is to reorganize the routines of the file and divide them into
> sub-categories, or even go through a deeper refactoring to help
> readers go through the existing 4.5k lines of code that are in this
> single file..

After I got all the tests passing in the port to Go, I split it up into 14 implementation and 15 test files (with all of jsonb_jsonpath.(sql.out) in one file). Was much easier to reason about that way.

https://github.com/theory/sqljson/tree/main/path/exec

Best,

David





Commits

  1. Add more test coverage for jsonpath "$.*" with arrays