Postgresql Create Json Object From Rows Definition Math