How can i use distinct in json type
if (v_exploratory_bug = true) then return query SELECT array_to_json(array_agg(row_to_json(resdt)