Search code examples
postgresqldatabase-replicationpostgresql-12

Can you logically replicate a physical Postgres replica?


The title is pretty much self-explanatory. To illustrate more, here's a picture:

[Live Database]-->(physical replication)-->[Physical Replica]-->(logical replication)-->[Logical Replica]

So the question is whether this setup is achievable? All the databases involved are PostgreSQL 12 instances


Solution

  • No, you cannot do that, because that would mean creating a logical replication slot on the physical standby. Attempting to create such a replication slot would lead to this error:

    ERROR:  logical decoding cannot be used while in recovery