b2bcreditonline=# select * from foo;
id | js | f1 | f2
----+--------------------------------------------------------------------------------+-----------+------------
1 | [{"key": "r1kval", "key2": "r1k2val"}, {"key": "r1kval2", "key2": "r1k2val2"}] | My text 1 | My text 1a
2 | [{"key": "r2kval", "key2": "r2k2val"}, {"key": "r2kval2", "key2": "r2k2val2"}] | My text 2 | My text 2a
(2 rows)
b2bcreditonline=# select
f.id, f.f1, f.f2, array_agg(t.key2) from foo as f, jsonb_to_recordset(js) as t(key2 text) group by
f.id;
ERROR: column "f.f1" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: select
f.id, f.f1, f.f2, array_agg(t.key2) from foo as f, js...
^