diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2017-01-19 12:00:00 -0500 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2017-01-20 09:04:49 -0500 |
commit | 665d1fad99e7b11678b0d5fa24d2898424243cd6 (patch) | |
tree | eefe3eb528f840780aef6c09939a1844dbabb30a /src/backend/commands/tablecmds.c | |
parent | ba61a04bc7fefeee03416d9911eb825c4897c223 (diff) | |
download | postgresql-665d1fad99e7b11678b0d5fa24d2898424243cd6.tar.gz postgresql-665d1fad99e7b11678b0d5fa24d2898424243cd6.zip |
Logical replication
- Add PUBLICATION catalogs and DDL
- Add SUBSCRIPTION catalog and DDL
- Define logical replication protocol and output plugin
- Add logical replication workers
From: Petr Jelinek <petr@2ndquadrant.com>
Reviewed-by: Steve Singer <steve@ssinger.info>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Erik Rijkers <er@xs4all.nl>
Reviewed-by: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r-- | src/backend/commands/tablecmds.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 6ed2a3dc4d1..c4b0011bdd6 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -12056,6 +12056,18 @@ ATPrepChangePersistence(Relation rel, bool toLogged) } /* + * Check that the table is not part any publication when changing to + * UNLOGGED as UNLOGGED tables can't be published. + */ + if (!toLogged && + list_length(GetRelationPublications(RelationGetRelid(rel))) > 0) + ereport(ERROR, + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("cannot change table \"%s\" to unlogged because it is part of a publication", + RelationGetRelationName(rel)), + errdetail("Unlogged relations cannot be replicated."))); + + /* * Check existing foreign key constraints to preserve the invariant that * permanent tables cannot reference unlogged ones. Self-referencing * foreign keys can safely be ignored. |