Your Create function that return table snippet doesn't have to use plpgsql, it can be written much simpler with only SQL ,like this:
create or replace function get_tags (tag text)
returns setof products_view
language sql
as
$$
select * from products_view where tag % any(categories);
$$
Your Create function that return table snippet doesn't have to use plpgsql, it can be written much simpler with only SQL ,like this:
create or replace function get_tags (tag text)
returns setof products_view
language sql
as
$$
select * from products_view where tag % any(categories);
$$
Yup you are right! Thank you for pointing it out! 🙌