Skip to content

pg_cron: cron.database_name does not support multiple databases #427

@shameerBhupathi

Description

@shameerBhupathi

Environment:
PostgreSQL 15,16,17,18 with pg_cron extension
Multiple databases: db01, db02, postgres
Platform: AWS RDS / Linux in RHEL 9

Issue Description:
Attempting to create the pg_cron extension in the db02 database fails with a configuration error, even though cron.database_name has been set via ALTER SYSTEM.

Steps to Reproduce:

  1. Run: ALTER SYSTEM SET cron.database_name = 'db01, db02,postgres';
  2. In the db02 database, run: CREATE EXTENSION pg_cron;

Error Message:
db02=# create extension pg_cron;
ERROR: can only create extension in database db01, db02,postgres
DETAIL: Jobs must be scheduled from the database configured in cron.database_name, since the pg_cron background worker reads job descriptions from this database.
HINT: Add cron.database_name = 'db02' in postgresql.conf to use the current database.

Root Cause Analysis:
The error suggests that cron.database_name is being treated as a single database identifier rather than parsing the comma-separated list. The extension expects an exact match between the current database and the configured value, but instead receives the entire string 'db01, db02,postgres'.

Expected Behavior:
pg_cron should parse comma-separated database names and allow the extension to be created in any of the listed databases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions