Recursive JSONB postgres
问题 I am trying to build a recursive CTE in Postgres that supports both arrays and objects, to return a list of key-value pairs and don't seem to be able to find a good example. This is my current code. with recursive jsonRecurse as ( select j.key as Path ,j.key ,j.value from jsonb_each(to_jsonb('{ "key1": { "key2": [ { "key3": "test3", "key4": "test4" } ] }, "key5": [ { "key6": [ { "key7": "test7" } ] } ] }'::jsonb)) j union all select jr.path || '.' || jr2.Key ,jr2.key ,jr2.value from