P
P
P7472022-01-25 07:36:39
PostgreSQL
P747, 2022-01-25 07:36:39

Convert json array to array in request?

Good afternoon!
There is a column in the table (column1) containing uuid identifiers in json format ["9ff57f69-262a-4eee-874f-6149e42b5e12","12fffa49-524d-4ddc-91f0-5c489591748e"]

How to make this array of json identifiers in a subquery uuid to convert to array?

That is, to get:

WHERE id IN ('9ff57f69-262a-4eee-874f-6149e42b5e12','12fffa49-524d-4ddc-91f0-5c489591748e')

Specifically:
WHERE id IN (column1)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
P747, 2022-01-25
@P747

Thank you all, it turns out that before that I tried, there was a problem in the mismatch of the uuid and text types, the doctrine did not display a detailed description
I solved the problem like this:

WHERE id::TEXT IN (SELECT json_array_elements_text(column1))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question