Skip to content

Conversation

jmcclell
Copy link

@jmcclell jmcclell commented May 27, 2025

Postgres 16 introduced the ability to create logical replication slots directly on read only standby instances. Unfortunately, a read/write transaction cannot be started on a read only standby instance. This change introduces the ability to create a read only transaction and ensures that all operations involving logical replication slots use said transaction type.

This change is backwards compatible with older versions of Postgres and will work on both primary and standby instances.

This change does alter the error users receive on versions older than 16 when attempting to manage a logical replication slot on a read only standby instance. Today, all resources supported by this provider trigger the following error when attempting to create them on a read only standby:

Error: could not start transaction: pq: cannot set transaction read-write mode during recovery

After this change, this continues to be the case for all resources except replication slots, which will instead show the following error for Postgres versions < 16:

Error: pq: logical decoding cannot be used while in recovery

jmcclell and others added 3 commits May 27, 2025 16:41
Postgres 16 introduced the ability to create logical replication slots
directly on read only standby instances. Unfortunately, a read/write
transaction cannot be started on a read only standby instance. This
change introduces the ability to create a read only transaction and
ensures that all operations involving replication slots use said
transaction type.

This change is backwards compatible with older versions of Postgres and
will work on both primary and standby instances.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants