1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-15 19:21:59 +03:00

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>
This commit is contained in:
Peter Eisentraut
2017-01-19 12:00:00 -05:00
parent ba61a04bc7
commit 665d1fad99
119 changed files with 13354 additions and 95 deletions

View File

@ -4286,6 +4286,69 @@ _copyPartitionCmd(const PartitionCmd *from)
return newnode;
}
static CreatePublicationStmt *
_copyCreatePublicationStmt(const CreatePublicationStmt *from)
{
CreatePublicationStmt *newnode = makeNode(CreatePublicationStmt);
COPY_STRING_FIELD(pubname);
COPY_NODE_FIELD(options);
COPY_NODE_FIELD(tables);
COPY_SCALAR_FIELD(for_all_tables);
return newnode;
}
static AlterPublicationStmt *
_copyAlterPublicationStmt(const AlterPublicationStmt *from)
{
AlterPublicationStmt *newnode = makeNode(AlterPublicationStmt);
COPY_STRING_FIELD(pubname);
COPY_NODE_FIELD(options);
COPY_NODE_FIELD(tables);
COPY_SCALAR_FIELD(for_all_tables);
COPY_SCALAR_FIELD(tableAction);
return newnode;
}
static CreateSubscriptionStmt *
_copyCreateSubscriptionStmt(const CreateSubscriptionStmt *from)
{
CreateSubscriptionStmt *newnode = makeNode(CreateSubscriptionStmt);
COPY_STRING_FIELD(subname);
COPY_STRING_FIELD(conninfo);
COPY_NODE_FIELD(publication);
COPY_NODE_FIELD(options);
return newnode;
}
static AlterSubscriptionStmt *
_copyAlterSubscriptionStmt(const AlterSubscriptionStmt *from)
{
AlterSubscriptionStmt *newnode = makeNode(AlterSubscriptionStmt);
COPY_STRING_FIELD(subname);
COPY_NODE_FIELD(options);
return newnode;
}
static DropSubscriptionStmt *
_copyDropSubscriptionStmt(const DropSubscriptionStmt *from)
{
DropSubscriptionStmt *newnode = makeNode(DropSubscriptionStmt);
COPY_STRING_FIELD(subname);
COPY_SCALAR_FIELD(drop_slot);
COPY_SCALAR_FIELD(missing_ok);
return newnode;
}
/* ****************************************************************
* pg_list.h copy functions
* ****************************************************************
@ -5086,6 +5149,21 @@ copyObject(const void *from)
case T_AlterPolicyStmt:
retval = _copyAlterPolicyStmt(from);
break;
case T_CreatePublicationStmt:
retval = _copyCreatePublicationStmt(from);
break;
case T_AlterPublicationStmt:
retval = _copyAlterPublicationStmt(from);
break;
case T_CreateSubscriptionStmt:
retval = _copyCreateSubscriptionStmt(from);
break;
case T_AlterSubscriptionStmt:
retval = _copyAlterSubscriptionStmt(from);
break;
case T_DropSubscriptionStmt:
retval = _copyDropSubscriptionStmt(from);
break;
case T_A_Expr:
retval = _copyAExpr(from);
break;