Search code examples
postgresqlreplicationsubscription

Logical Replication in PostgreSQL 10


Is it possible to create a Logical Replication in PostgreSQL 10 that I can just replicate a column from a table, like can I say to my create publication that I want just a column from that table ?

thanks in advance.


Solution

  • No, this is not possible.

    How would you handle an INSERT or a DELETE?
    How would you identify the row that should be modified with an UPDATE?

    That said, you could define a BEFORE trigger FOR EACH ROW on the standby table that keeps all columns except the one you want to change at their original values. You'd have to use ALTER TABLE ... ENABLE REPLICA TRIGGER so that it is only activated during logical replication.