I have a jsonb value of approximate structure:
'{
"a": {
"result": 10,
"values": [
{"date": "2024-11-10", "question": 5},
{"date": "2024-11-11", "question": 10}
]
}
}'
I need to add another object to the "values" array:
{"date": "2024-11-12", "question": 1}
Expected result:
'{
"a": {
"result": 10,
"values": [ [
{"date": "2024'-11-10", "question": 5},
{"date": "2024'-11-11", "question": 10},
{"date": "2024'-11-12", "question": 1}
]
}
}'
How to achieve this in Postgres?
text, i.e. that other question is a mess. And John's new answer here is also clearly better than anything offered over there.