What's the best way to run pg_cron on a database other than defaultdb?
Since pgcron is now supported in PostgreSQL 12 managed db, what would be the best way to use it if we have a database that is not defaultdb? Currently you can only install the pgcron extension into defaultdb. Since pgcron uses libpq, you can also run periodic jobs on other databases or other machines but you have to be a superuser so that is ruled out. Foreign Data Wrappers are the only other option I can see, but that seems like an unnecessary complication. I’d like to be able to just install the extension into my database but this requires modifying postgresql.conf to add cron.databasename.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×