Folks,
While querying some JSONB blobs at work in preparation for a massive
rework of the data infrastructure, I ran into things that really
puzzled me, to wit:
SELECT * FROM unnest('["a","b","c"]'::jsonb);
ERROR: function unnest(jsonb) does not exist
SELECT * FROM jsonb_array_elements('["a","b","c"]'::jsonb);
value
───────
"a"
"b"
"c"
(3 rows)
Similar things happen with the other functions matching
jsonb?_array_elements(_text)?
These functions correctly identify JSON[B] things which are not, at
their top level, arrays, and error out appropriately.
What this hints to me is that json_array_elements() and friends have
access to things that at least in theory UNNEST could have access to.
Is making those things accessible to UNNEST, etc., a reasonable
direction to go?
Another option I came up with is to make functions that match
jsonb?_array_elements(_text)?(_with_ordinality), but that seems
somewhat tedious and error-prone on the maintenance side.
What say?
Cheers,
David.
--
David Fetter <[email protected]> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: [email protected]
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers