this throws an "ERROR: must be superuser to create a job for another role"
SELECT cron.schedule_in_database(
'refresh_mv',
'30 5 * * *',
'REFRESH MATERIALIZED VIEW schema.my_view;',
'my-db',
current_user, -- or specified as 'my_user'
true
);
but this will work, and schedule the job as current_user:
SELECT cron.schedule_in_database(
'refresh_mv',
'30 5 * * *',
'REFRESH MATERIALIZED VIEW schema.my_view;',
'my-db'
);
seems unintended and extremely confusing.
The error is thrown here, and only checks if the userstring is not empty. It should also check whether it is different from the current user before throwing the error.
|
if (usernameText != NULL) |