Re: proposal: jsonb_populate_array

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: proposal: jsonb_populate_array
Дата
Msg-id CAFj8pRAyE4c4EV8SzSin5J2p+T9kQTs8eAOzeSp6MyVRDF2R4w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: proposal: jsonb_populate_array  (Vik Fearing <vik@postgresfriends.org>)
Ответы Re: proposal: jsonb_populate_array  (Vik Fearing <vik@postgresfriends.org>)
Список pgsql-hackers


út 15. 8. 2023 v 7:48 odesílatel Vik Fearing <vik@postgresfriends.org> napsal:
On 8/14/23 15:37, Pavel Stehule wrote:
> po 14. 8. 2023 v 15:09 odesílatel Erik Rijkers <er@xs4all.nl> napsal:
>
>> Op 8/14/23 om 14:51 schreef Pavel Stehule:> po 14. 8. 2023 v 11:32
>> odesílatel Alvaro Herrera <alvherre@alvh.no-ip.org>
>>   > with proposed function I can write
>>   >
>>   > select jsonb_populate_array(null:date[],
>>   > '["2023-07-13","2023-07-14"]'::jsonb)
>>   >
>> Not yet committed, but outstanding
>> SQL/JSON patches (v11) will let you do:
>>
>> select json_query(
>>       '["2023-07-13", "2023-07-14"]'::jsonb
>>     , '$' returning date[]
>> );
>>          json_query
>> -------------------------
>>    {2023-07-13,2023-07-14}
>> (1 row)
>>
>> That's (more or less) what you want, no?
>>
>
> Yes, the functionality is exactly the same, but still maybe for  completeness
> the function json_populate_array can be nice.
>
> In old API the transformations between json and row/record types is well
> covered, but for array, only direction array->json is covered

I don't think we should be extending the old API when there are Standard
ways of doing the same thing.  In fact, I would like to see the old way
slowly be deprecated.

> I think so this can be +/- 40 lines of C code

It seems to me like a good candidate for an extension.

Unfortunately, these small extensions have zero chance to be available for users that use some cloud postgres.

 
--
Vik Fearing

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

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