I have two tables as follows
accounts
------------------------------------------
| ID | LOCATIONS |
|------------------------------------------|
| 1 | [{ "id" : 1}, { "id" : 3 }] |
|------------------------------------------|
| 2 | [] |
------------------------------------------
regions
----------------------------
| ID | DATA |
|---------------------------|
| 1 | {"name": "South"} |
|---------------------------|
| 2 | {"name": "West"} |
|---------------------------|
| 3 | {"name": "North"} |
|---------------------------|
| 4 | {"name": "East"} |
---------------------------
locations is of type jsonb[]
Now I wanted to get result as follows
------
| NAME |
|------|
| South|
|------|
| North|
------
Please help with the postgresql query to get this.