| From: | Aleksander Alekseev <aleksander(at)timescale(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Should we support casting between ARRAYs and JSON(B)? |
| Date: | 2024-10-28 17:06:01 |
| Message-ID: | CAJ7c6TP8eTH=LY2Juos2aaxEu0qrU4aQ5SQYhv6ukPh__gn6pQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi hackers,
While reviewing another patch [1] I came to an idea to try something stupid:
=# select '{1,2,3}' :: int[];
int4
---------
{1,2,3}
=# select '{1,2,3}' :: int[] :: jsonb[];
ERROR: cannot cast type integer[] to jsonb[]
=# select '[1,2,3]' :: jsonb;
jsonb
-----------
[1, 2, 3]
=# select '[1,2,3]' :: jsonb :: int[];
ERROR: cannot cast type jsonb to integer[]
Does anyone believe that this should work and/or would be convenient
if it worked? I can imagine cases when one would like to use array_*
functions for JSON(B) although personally I didn't encounter such a
case (yet?).
Thoughts?
[1]: https://postgr.es/m/CAEG8a3J41a4dpw_-F94fF-JPRXYxw-GfsgoGotKcjs9LVfEEvw%40mail.gmail.com
--
Best regards,
Aleksander Alekseev
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jelte Fennema-Nio | 2024-10-28 17:07:57 | Re: protocol-level wait-for-LSN |
| Previous Message | Jelte Fennema-Nio | 2024-10-28 17:02:30 | Re: protocol-level wait-for-LSN |