| From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
|---|---|
| To: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: proposal: jsonb_populate_array |
| Date: | 2023-08-14 12:51:43 |
| Message-ID: | CAFj8pRBNMJj=p3Mbk4FLL5FhjhsypV9Tyoc8wKzjO36ynTM3iw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
po 14. 8. 2023 v 11:32 odesílatel Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
napsal:
> On 2023-Aug-14, Pavel Stehule wrote:
>
> > jsonb_populate_array(anyarray, jsonb) returns anyarray
> >
> > Usage:
> >
> > select jsonb_populate_array(null::text[],
> '["cust_full_name","cust_email"]')
>
> I don't understand what this does. Can you be more explicit?
>
example
'["2023-07-13","2023-07-14"]'::jsonb --> {2023-07-13,2023-07-14}::date[]
Now, I have to transform to table, casting, and back transformation to
array, and I cannot to write generic function. I can run just "slow" query
select array_agg(value::date) from
jsonb_array_elements_text('["2023-07-13","2023-07-14"]'::jsonb);
with proposed function I can write
select jsonb_populate_array(null:date[],
'["2023-07-13","2023-07-14"]'::jsonb)
Regards
Pavel
> --
> Álvaro Herrera 48°01'N 7°57'E —
> https://www.EnterpriseDB.com/
> Maybe there's lots of data loss but the records of data loss are also lost.
> (Lincoln Yeoh)
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Pavel Stehule | 2023-08-14 12:54:22 | Re: Extract numeric filed in JSONB more effectively |
| Previous Message | vignesh C | 2023-08-14 11:59:30 | Re: [PATCH] Reuse Workers and Replication Slots during Logical Replication |