I have a PostgreSQL function (or table) which gives me the following output:
Sl.no username Designation salary etc.. 1 A XYZ
There is no proper way to do this in plain SQL or PL/pgSQL.
It will be way better to do this in the application, that gets the data from the DB.