I have a specific request to reflect a user only once if that user has more than one policy,i need a way to left blank duplicated fields and only show real value one time like below:

CREATE OR REPLACE FUNCTION get_user_name(user_pk NUMERIC)
RETURNS text AS
$body$
DECLARE users_array NUMERIC[];
BEGIN
IF (select array_position(users_array, user_pk)) THEN
return ' ';
ELSE
users_array = array_append(users_array, user_pk);
return (SELECT first_name || ' ' || last_name FROM user where id=user_pk);
END IF;
END
$body$
LANGUAGE plpgsql;
SELECT
row_number() OVER () as id,
get_user_name(user_pk := users.id) as client,
policy.policy as policy,
FROM policies_policy as policy
INNER JOIN user users
order by users.id;
I need a way to not re declare users_array every time function called