Since pg_cron 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 pg_cron extension into defaultdb. Since pg_cron 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.database_name.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Click below to sign up and get $200 of credit to try our products over 60 days!