K
K
kirillinyakin2021-09-15 12:57:24
PostgreSQL
kirillinyakin, 2021-09-15 12:57:24

How to cast Json Array to Postgres Array to use inside Any keyword in PostgreSQL?

I want to use the Any keyword to check if there are values ​​inside the Json field, but I don't understand how to cast json into an array, how can this be done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2021-09-15
@kirillinyakin

Well, for example:

# select array_agg(a) from jsonb_array_elements_text('[1, 5, "a", {}]'::jsonb) t (a);
  array_agg
--------------
 {1,5,a,"{}"}
(1 row)

Probably, there are still options, functions and operators there are full .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question