BUG #18918: cron.schedule_in_database ERROR: must be superuser to create a job for another role

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: silvanlaube(at)hotmail(dot)com
Subject: BUG #18918: cron.schedule_in_database ERROR: must be superuser to create a job for another role
Date: 2025-05-08 15:54:53
Message-ID: 18918-b8729632b5e56dea@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 18918
Logged by: Silvan Laube
Email address: silvanlaube(at)hotmail(dot)com
PostgreSQL version: 16.8
Operating system: whatever Azure uses
Description:

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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2025-05-08 16:17:15 BUG #18919: Source archives in ftp/source/v17.5 are missing
Previous Message Robin Haberkorn 2025-05-08 12:55:41 Re: BUG #18908: DEREF_OF_NULL: After having been assigned to a NULL value at descriptor.c:203