How to select values in a JSON type of column?
| От | Snjezana Frketic |
|---|---|
| Тема | How to select values in a JSON type of column? |
| Дата | |
| Msg-id | CA+9_ahaS5YkqQ5B8=S6KRgSaspk0uedT5gBP0NS_YU2ym9O68g@mail.gmail.com обсуждение исходный текст |
| Ответы |
Re: How to select values in a JSON type of column?
Re: How to select values in a JSON type of column? |
| Список | pgsql-general |
Hi!
I have a column called
The column looks like
targeting in a table called campaigns .The column looks like
{
"targets": [
{
"audienceSegments": [
{
"includes": [
{
"consumer": "selection",
"segments": {
"allOf": [
{
"provider": "a",
"ids": [
{
"id": "110418"
},
{
"id": "110430"
},
{
"id": "110433"
}
]
}
]
}
}
],
"excludes": [
{
"consumer": "selection",
"segments": {
"allOf": [
{
"provider": "a",
"ids": [
{
"id": "109776"
}
]
}
]
}
}
]
}
]
}
]
}
and I need to select all the
Currently, I am doing it like this
ids in includes.Currently, I am doing it like this
SELECT
targeting#>'{targets,0,audienceSegments,0,includes,0,segments,allOf,0,ids}'FROM campaigns; and that works, but, I don’t want to have a fixed path because positions could change like 0 could become 1,
Any idea of how to always select
includes and excludes could change positions, allOf could be anyOf etc.Any idea of how to always select
ids in includes no matter the changes?Thank you!
Anna
В списке pgsql-general по дате отправления: