On 5/19/2015 2:07 PM, Adrien(dot)Sales(at)gmail(dot)com wrote:
> CREATE OR REPLACE FUNCTION refresh_astre()
> RETURNS void
> SECURITY DEFINER -- <== added this
> AS $$
> BEGIN
> REFRESH MATERIALIZED VIEW vm_titi with data;
> RETURN;
> END;
> $$ LANGUAGE plpgsql;
>
> select refresh_astre();
>
> grant execute on function refresh_astre() to user_usr;
>
> psql -U user_usr test
>
> test=> select refresh_astre();
> ...
try again, with SECURITY DEFINER in the function declaration. This
says when this function is run, it runs with the permissions of the
function owner, rather than the caller.
.
--
john r pierce, recycling bits in santa cruz