Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can’t select * into json_agg


Does

    SELECT json_agg(row_to_json(*))
work?


There's also json_build_object for building a JSON object and then you can use json_agg inside that.


    select array_to_json(array_agg(row_to_json(t))) from (select * from name) t
seems to work...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: