Skip to content

Q: "Must be superuser to create this extension." #424

@laur89

Description

@laur89

Attempting to install this extension. Added an init script to create the pg_cron functions and metadata tables, but still getting a permission error when a db user tries to use it:

2026-04-01 05:20:30.690 CEST [11989] ERROR:  permission denied to create extension "pg_cron"
2026-04-01 05:20:30.690 CEST [11989] HINT:  Must be superuser to create this extension.
2026-04-01 05:20:30.690 CEST [11989] CONTEXT:  SQL statement "CREATE EXTENSION IF NOT EXISTS pg_cron"
        PL/pgSQL function inline_code_block line 4 at SQL statement
2026-04-01 05:20:30.690 CEST [11989] STATEMENT:  DO $$
        BEGIN
        IF current_database() NOT LIKE 'prisma_migrate_shadow_db%' THEN
          CREATE EXTENSION IF NOT EXISTS pg_cron;
        ELSE
            CREATE SCHEMA IF NOT EXISTS cron;
            CREATE TABLE IF NOT EXISTS cron.job (
                jobid BIGINT PRIMARY KEY,
                schedule TEXT,
                command TEXT,
                nodename TEXT,
                nodeport INTEGER,
                database TEXT,
                username TEXT,
                active BOOLEAN,
                jobname TEXT
            );
        END IF;
        END $$;

This is the initial pgres log after the initial DB startup that's executing this init script. No idea whether it looks OK or not.

background worker "pg_cron launcher" (PID 58) exited with exit code 1

does sounds suspicious.


Note postrgres was started with -c shared_preload_libraries=pg_cron -c cron.database_name=postgres options.

What am I missing. Does that particular application db user need to be granted extra permissions?

Note the error seems to be caused by split-pro program's migration logic found here.

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