From: | David Fetter <david(at)fetter(dot)org> |
---|---|
To: | PG Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | JSON[B] arrays are second-class citizens |
Date: | 2016-05-31 20:34:22 |
Message-ID: | 20160531203422.GA14221@fetter.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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 <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2016-05-31 20:36:30 | Re: Rename max_parallel_degree? |
Previous Message | Jeffrey.Marshall | 2016-05-31 20:33:17 | Re: [GENERAL] Permission Denied Error on pg_xlog/RECOVERYXLOG file |