Re: Extract numeric filed in JSONB more effectively

Поиск
Список
Период
Сортировка
От Andy Fan
Тема Re: Extract numeric filed in JSONB more effectively
Дата
Msg-id CAKU4AWoVBY99ECX5C8XtrfaXCs2SonJjSGFOQrFUPxtRo4THPg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Extract numeric filed in JSONB more effectively  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: Extract numeric filed in JSONB more effectively  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers

My idea of an ideal solution is the introduction of the possibility to use "any" pseudotype as return type with possibility to set default return type. Now, "any" is allowed only for arguments. The planner can set the expected type when it knows it, or can use the default type.

so for extraction of jsonb field we can use FUNCTION jsonb_extract_field(jsonb, text) RETURNS "any" DEFAULT jsonb

Is this an existing framework or do you want to create something new? 

if we call SELECT jsonb_extract_field(..., 'x') -> then it returns jsonb, if we use SELECT jsonb_extract_field('...', 'x')::date, then it returns date

If so, what is the difference from the current  jsonb->'f'   and (jsonb->'f' )::date?  

With this possibility we don't need to touch to cast functions, and we can simply implement similar functions for other non atomic types.
 
What do you mean by "atomic type" here?   If you want to introduce some new framework,  I think we need a very clear benefit.  

--
Best Regards
Andy Fan

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

Предыдущее
От: Michael Meskes
Дата:
Сообщение: Re: ECPG Semantic Analysis
Следующее
От: Vik Fearing
Дата:
Сообщение: Re: proposal: jsonb_populate_array