citusdata / pg_cron

Run periodic jobs in PostgreSQL
PostgreSQL License
2.9k stars 195 forks source link

Fix bug with invalidation of CachedCronJobRelationId #346

Closed CyberDem0n closed 3 months ago

CyberDem0n commented 3 months ago

The callback was registered only for bgworker and as a result client backends were failing to unschedule jobs if the extension was droped and recreated in the same session:

CREATE EXTENSION pg_cron;
SELECT cron.schedule('0 10 * * *', 'VACUUM');
SELECT cron.unschedule(1);
DROP EXTENSION pg_cron;
CREATE EXTENSION pg_cron;
SELECT cron.schedule('0 10 * * *', 'VACUUM');
SELECT cron.unschedule(1);
ERROR:  could not open relation with OID 16388

Update, just found out that this issue is already discovered (#344) and there is a fix (#345) that takes different approach.

marcoslot commented 3 months ago

Thanks!