A publication can be defined on any physical replication master. The node where a publication is defined is referred to as publisher. A publication is a set of changes generated from a table or a group of tables, and might also be described as a change set or replication set. Each publication exists in only one database.
Publications are different from schemas and do not affect how the table is
accessed. Each table can be added to multiple publications if needed.
Publications may currently only contain tables. Objects must be added
explicitly, except when a publication is created for ALL
TABLES
.
Publications can choose to limit the changes they produce to
any combination of INSERT
, UPDATE
, and
DELETE
, similar to how triggers are fired by
particular event types. If a table without a REPLICA
IDENTITY
is added to a publication that
replicates UPDATE
or DELETE
operations then subsequent UPDATE
or DELETE
operations will fail on the publisher.
Every publication can have multiple subscribers.
A publication is created using the CREATE PUBLICATION command and may later be altered or dropped using corresponding commands.
The individual tables can be added and removed dynamically using
ALTER PUBLICATION. Both the ADD
TABLE
and DROP TABLE
operations are
transactional; so the table will start or stop replicating at the correct
snapshot once the transaction has committed.