run_as field syntax #399
-
Hi, When i execute a refresh on a materialized view wiht pg_timetable PostgreSQL ask the account be the owner of a materialized view to refresf it. I have seen in the task table the run_as field and i said to me it's the solution for executing pg_timetable with another account which would be the materialized view owner. I imagine i must set in this field the user and the password of the materialized view owner. After tried some poor ideas, i ask for your help, is it the right way ? can you give me a sample syntax ? thanks Rémy |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello,
CREATE ROLE view_owner; Then if you want to run some task under the SET ROLE view_owner;
REFRESH MATERIALIZED VIEW some_view; -- or whatever your task is doing
RESET ROLE; To achieve this the role under which pg_timetable is started should be the part of the Best regards! |
Beta Was this translation helpful? Give feedback.
Hello,
run_as
field literally means the role name to run this task under. Suppose we have a roleThen if you want to run some task under the
view_owner
role you set therun_as
field to this value. There is no other connection info expected because under the hood this will look like:To achieve this the role under which pg_timetable is started should be the part of the
view_owner
role. That means the connection is not established under theview_owner
role thus you don't need to specify a password.Best regards!