JSON[B] arrays are second-class citizens

Поиск
Список
Период
Сортировка
От David Fetter
Тема JSON[B] arrays are second-class citizens
Дата
Msg-id 20160531203422.GA14221@fetter.org
обсуждение исходный текст
Ответы Re: JSON[B] arrays are second-class citizens  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список 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@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate



В списке pgsql-hackers по дате отправления:

Предыдущее
От:
Дата:
Сообщение: Re: [GENERAL] Permission Denied Error on pg_xlog/RECOVERYXLOG file
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: Rename max_parallel_degree?