Heikki Linnakangas <hlinnakangas@vmware.com> writes:
> gin_extract_jsonb recursively extracts all the elements, keys and values
> of any sub-object too, but JB_ROOT_COUNT only counts the top-level elements.
Got it. So if the top level is empty, we can exit early, but otherwise we
use its length * 2 as a guess at how big the output will be; which will
be right if it's an object without further substructure, and otherwise
might need enlargement.
> (I hope this is made a bit more clear in the comments I added in the
> patch I posted this morning)
Didn't read that yet, but will incorporate this info into the jsonb_gin
patch I'm working on.
regards, tom lane