citusdata / pg_cron

Run periodic jobs in PostgreSQL
PostgreSQL License
2.89k stars 193 forks source link

Do not cache CronJobRelationId in job unschedule functions #345

Closed hari90 closed 3 months ago

hari90 commented 3 months ago

unschedule and unschedule_named use CronJobRelationId() which caches the CachedCronJobRelationId on the backend of the user connection. This connection does not register for cache invalidations so this value is not cleared when the extension is dropped and recreated leading to errors.

This change fixes the issue adding CronJobRelationIdUncached function and using in places where we do not want to cache the value.

Fixes #344

hari90 commented 3 months ago

@microsoft-github-policy-service agree company="YugabyteDB"

marcoslot commented 3 months ago

Alexander opened an alternative fix, which made a lot of sense, so I merged that one https://github.com/citusdata/pg_cron/pull/346