Postgresql Function Json Set Up