Skip to content

Event triggers don't work on read replicas #3414

@steve-chavez

Description

@steve-chavez

Problem

See https://stackoverflow.com/questions/29931136/postgresql-replica-where-i-can-create-triggers/29932655#29932655.

This means that PostgREST NOTIFY reloading won’t work in read replicas.

Previously, I thought this was only a problem with just LISTEN/NOTIFY on read replicas (#2781), but it's worse.

Solution

Enable a configurable connection string for the LISTEN channel.

db-channel-uri = "postgres://authenticator:mysecretpassword@localhost:5433/postgres?parameters=val"

Similar to the https://postgrest.org/en/v12/references/configuration.html#db-uri. By default it will use the same value as the db-uri.

This way the LISTEN channel can point to the primary instead of the replica and notify reloading can work normally.


Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa feature, ready for implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions