I have the following function defined in the database:
BEGIN
create or replace function get_prof(email text)
returns json as $$
declare
user_profile json;
begin
-- Direct query to auth.users (authentication-related data)
select row_to_json(u) into user_profile
from auth.users u
where u.email = email;
-- Return the JSON result
return user_profile;
end;
$$ language plpgsql;
END;
I want to use this function for getting the first and last name of a user by its email.
However, when I try to access the function I get:
permission denied for schema public
I already executed: grant select on auth.users to authenticated
(I made sure user’s role is authenticated)
How can I access the function?