Given a table with jsonb field and a list of attribute names. How do I go about formatting a query to select all the attributes in the list?
I have a list with attribute name: Never say 'Never'
create table t(a jsonb);
insert into t values('{ "Never say ''Never''": "I won''t"}'::jsonb);
select a->>'Never say ''Never''' as "Never say 'Never'" from t;
Something like that, but no quotes for attribute names:
pgp.as.format(attrs.map((attr, i) => `a->>'$${i}~' as $${i}~`).join(', '), attrs);