Skip to content
Advertisement

Extracting the same values from a JSON object

I have a problem with taking all values under the “id_ref_directory” keys.

I have a temp table:

I prase a JSON into temp table:

I have var int[]:

And I have this value under “id_ref_directory” key:

I need to write into var_territory_listthis from JSON above (values of keys “id_ref_directory”):

I thought that I could solve everything with simple operators like #> but I failed. Maybe it is necessary to do it through a cycle? Thank you in advance!

Advertisement

Answer

You can extract the array into rows:

If you really need an array, you can wrap it in an ARRAY() call:

Disclosure: I work for EnterpriseDB (EDB)

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement