Simple table in PostgreSQL 12.3
create table aaa(id integer, data json);
In data column stores JSON with the following form:
{
"foo": 1,
"persons": [
{
"name": "2fdsdsd",
"test": {
"id": "123",
"age": 32
}
}
],
"some_prop": "123"
}
I need to find all records from aaa where test.id = '123' or where test = null.
integernotindeger. Your example json is invalid because of unmatched quotes. Are you actually usingjsontype orjsonb? What have you tried so far? By second one you mean those records wheretest.idis either'123'ornull?