-
Notifications
You must be signed in to change notification settings - Fork 591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support concatenate (||
) for jsonb arrays
#12143
Comments
You may try select array_agg(x) from jsonb_array_elements_text( '["1","2","3"]'::jsonb) as t(x); |
@xxchan Hi, thanks for your reply! My actual needs is to concatenate two json array into a single array, just like bellow: SELECT x || y as concated
FROM (
VALUES ('["1","2","3"]'::jsonb, '["4","5","6"]'::jsonb)
) AS t (x, y); the expected result is: according to the example you provided above, the sql should change to: select array_agg(u.a) || array_agg(u.b) as concated from (
select jsonb_array_elements_text(x) as a, jsonb_array_elements_text(y) as b
from (
values ('["1","2","3"]'::jsonb, '["4","5","6"]'::jsonb)
) as t (x, y)
) as u; it looks like more verbose(and maybe it is not performant? I think). |
We can support the
Does it fit your needs? |
exactly! I would be appreciate if this |
||
) for jsonb
||
) for jsonb||
) for jsonb arrays
will be tracked by #12180 |
Is your feature request related to a problem? Please describe.
select '["1","2","3"]'::jsonb::varchar[];
this sql will cause a bind error
Describe the solution you'd like
No response
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: