4 ms·
What, besides being implemented in Node, makes this substantially different from using the built in json_agg function from Postgres, as in: https://stackoverfl
by llarsson 7y ago
What, besides being implemented in Node, makes this substantially different from using the built in json_agg function from Postgres, as in:
https://stackoverflow.com/questions/24006291/postgresql-return-result-set-as-json-array/24006432 https://stackoverflow.com/questions/24006291/postgresql-retu...
- soheilpro 7y agoI made this because I have a bunch of .sql files that I want to run against Postgres and then process the results with other tools. I cannot simply go and add json_agg to them.
- teej 7y agoYou can’t select * into json_agg
- striking 7y agoDoes SELECT json_agg(row_to_json(*)) work?
- newaccoutnas 7y agoThere's also json_build_object for building a JSON object and then you can use json_agg inside that.
- eddyg 7y agoselect array_to_json(array_agg(row_to_json(t))) from (select * from name) t seems to work...