On Fri, Oct 31, 2014 at 11:27 AM, Michael Paquier <michael.paqu...@gmail.com
> wrote:

> So, what I think is missing is really a friendly interface to manipulate
> JsonbContainers directly, and I think that we are not far from it with
> something like this set, roughly:
> - Initialization of an empty container
> - Set of APIs to directly push a value to a container (boolean, array,
> null, string, numeric or other jsonb object)
> - Initialization of JsonbValue objects
>
Here are more thoughts among those lines looking at the current state of
the patch 4 that introduces the infrastructure of the whole feature. This
would make possible in-memory manipulation of jsonb containers without
relying on a 3rd-part set of APIs like what this patch is doing with
ObjTree to deparse the DDL parse trees.
1) Set of constructor functions for JsonbValue: null, bool, string, array,
JSONB object for nested values. Note that keys for can be used as Jsonb
string objects
2) Lookup functions for values in a JsonbContainer. Patch 4 is introducing
that with find_string_in_jsonbcontainer and find_bool_in_jsonbcontainer. We
may as well extend it to be able to look for another Jsonb object for
nested searches for example.
3) Functions to push JsonbValue within a container, using a key and a
value. This is where most of the work would be necessary, for bool, null,
string, Jsonb object and numeric.

This infrastructure would allow in-memory manipulation of jsonb containers.
Containers that can then be easily be manipulated to be changed back to
strings and for value lookups using key strings.
Regards,
--
Michael

Reply via email to