I have an RDS postgres database with pg_cron installed. Dev ops is claiming that pg_cron can only be installed for the default "postgres" database.
I would like to be able to schedule jobs in pg_cron, but any attempt to do so from my database receives the well-known
ERROR: cross-database references are not implemented: "postgres.cron.job"
I would like to be able to run the select statement (to create the job) and the update statement (to set it to the correct database) from TypeORM migration scripts. 99% of these scripts would be run while connected to my own database, and only these select/update statements to schedule jobs would be connected to "postgres". The scripts will not be ordered, so that I can wait until the end, switch to another data source, and then continue running the remainder. They will occur in some semi-random order as myself and other developers recognize the need to add, remove, or modify scheduled jobs.
Is there (in Postgres) syntax that in one or more statements, allows you to specify that you want to run a specific statement as if it were with a new connection to another database running on the Postgres server?
If I were using psql, I might just do \c postgres
and then select cron.schedule(blah blah);
. I'm not using psql. I'm not attempting any joins. I'd just like to switch databases, run the statement (or two), and switch back. It'd be ok if this were inside of an anonymous do $$ begin end $$;
block.
I cannot figure out what to even google for that doesn't get a thousand false hits, or doesn't immediately lead to C embedded SQL's CONNECT TO
statement which doesn't seem to have a pgplsql equivalent.