Im trying to use json_agg function on postgresql but it keeps throwing error saying
ERROR: function json_agg(character varying, character varying) does not exist HINT: No function matches the given name and argument types. You might need to add explicit type casts. SQL state: 42883"
The problem comes when i am trying to agg multiple columns but not all.
i.e
SELECT json_agg(users.*) as users
FROM users
works fine, same with single column query
i.e
SELECT json_agg(users.id) as users FROM users
but if I'm trying to agg multiple columns i.e
SELECT json_agg(users.id, users.name, users.address) as users
FROM users
it throws error shown above, why? Is that not possible or is there some specific syntax required?