mirror of
https://github.com/postgres/postgres.git
synced 2025-08-30 06:01:21 +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:
@@ -44,9 +44,11 @@
|
||||
#include "commands/portalcmds.h"
|
||||
#include "commands/prepare.h"
|
||||
#include "commands/proclang.h"
|
||||
#include "commands/publicationcmds.h"
|
||||
#include "commands/schemacmds.h"
|
||||
#include "commands/seclabel.h"
|
||||
#include "commands/sequence.h"
|
||||
#include "commands/subscriptioncmds.h"
|
||||
#include "commands/tablecmds.h"
|
||||
#include "commands/tablespace.h"
|
||||
#include "commands/trigger.h"
|
||||
@@ -209,6 +211,11 @@ check_xact_readonly(Node *parsetree)
|
||||
case T_CreateForeignTableStmt:
|
||||
case T_ImportForeignSchemaStmt:
|
||||
case T_SecLabelStmt:
|
||||
case T_CreatePublicationStmt:
|
||||
case T_AlterPublicationStmt:
|
||||
case T_CreateSubscriptionStmt:
|
||||
case T_AlterSubscriptionStmt:
|
||||
case T_DropSubscriptionStmt:
|
||||
PreventCommandIfReadOnly(CreateCommandTag(parsetree));
|
||||
PreventCommandIfParallelMode(CreateCommandTag(parsetree));
|
||||
break;
|
||||
@@ -1578,6 +1585,33 @@ ProcessUtilitySlow(ParseState *pstate,
|
||||
address = CreateAccessMethod((CreateAmStmt *) parsetree);
|
||||
break;
|
||||
|
||||
case T_CreatePublicationStmt:
|
||||
address = CreatePublication((CreatePublicationStmt *) parsetree);
|
||||
break;
|
||||
|
||||
case T_AlterPublicationStmt:
|
||||
AlterPublication((AlterPublicationStmt *) parsetree);
|
||||
/*
|
||||
* AlterPublication calls EventTriggerCollectSimpleCommand
|
||||
* directly
|
||||
*/
|
||||
commandCollected = true;
|
||||
break;
|
||||
|
||||
case T_CreateSubscriptionStmt:
|
||||
address = CreateSubscription((CreateSubscriptionStmt *) parsetree);
|
||||
break;
|
||||
|
||||
case T_AlterSubscriptionStmt:
|
||||
address = AlterSubscription((AlterSubscriptionStmt *) parsetree);
|
||||
break;
|
||||
|
||||
case T_DropSubscriptionStmt:
|
||||
DropSubscription((DropSubscriptionStmt *) parsetree);
|
||||
/* no commands stashed for DROP */
|
||||
commandCollected = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
elog(ERROR, "unrecognized node type: %d",
|
||||
(int) nodeTag(parsetree));
|
||||
@@ -1941,6 +1975,12 @@ AlterObjectTypeCommandTag(ObjectType objtype)
|
||||
case OBJECT_MATVIEW:
|
||||
tag = "ALTER MATERIALIZED VIEW";
|
||||
break;
|
||||
case OBJECT_PUBLICATION:
|
||||
tag = "ALTER PUBLICATION";
|
||||
break;
|
||||
case OBJECT_SUBSCRIPTION:
|
||||
tag = "ALTER SUBSCRIPTION";
|
||||
break;
|
||||
default:
|
||||
tag = "???";
|
||||
break;
|
||||
@@ -2232,6 +2272,9 @@ CreateCommandTag(Node *parsetree)
|
||||
case OBJECT_ACCESS_METHOD:
|
||||
tag = "DROP ACCESS METHOD";
|
||||
break;
|
||||
case OBJECT_PUBLICATION:
|
||||
tag = "DROP PUBLICATION";
|
||||
break;
|
||||
default:
|
||||
tag = "???";
|
||||
}
|
||||
@@ -2602,6 +2645,26 @@ CreateCommandTag(Node *parsetree)
|
||||
tag = "CREATE ACCESS METHOD";
|
||||
break;
|
||||
|
||||
case T_CreatePublicationStmt:
|
||||
tag = "CREATE PUBLICATION";
|
||||
break;
|
||||
|
||||
case T_AlterPublicationStmt:
|
||||
tag = "ALTER PUBLICATION";
|
||||
break;
|
||||
|
||||
case T_CreateSubscriptionStmt:
|
||||
tag = "CREATE SUBSCRIPTION";
|
||||
break;
|
||||
|
||||
case T_AlterSubscriptionStmt:
|
||||
tag = "ALTER SUBSCRIPTION";
|
||||
break;
|
||||
|
||||
case T_DropSubscriptionStmt:
|
||||
tag = "DROP SUBSCRIPTION";
|
||||
break;
|
||||
|
||||
case T_PrepareStmt:
|
||||
tag = "PREPARE";
|
||||
break;
|
||||
@@ -3166,6 +3229,26 @@ GetCommandLogLevel(Node *parsetree)
|
||||
lev = LOGSTMT_DDL;
|
||||
break;
|
||||
|
||||
case T_CreatePublicationStmt:
|
||||
lev = LOGSTMT_DDL;
|
||||
break;
|
||||
|
||||
case T_AlterPublicationStmt:
|
||||
lev = LOGSTMT_DDL;
|
||||
break;
|
||||
|
||||
case T_CreateSubscriptionStmt:
|
||||
lev = LOGSTMT_DDL;
|
||||
break;
|
||||
|
||||
case T_AlterSubscriptionStmt:
|
||||
lev = LOGSTMT_DDL;
|
||||
break;
|
||||
|
||||
case T_DropSubscriptionStmt:
|
||||
lev = LOGSTMT_DDL;
|
||||
break;
|
||||
|
||||
/* already-planned queries */
|
||||
case T_PlannedStmt:
|
||||
{
|
||||
|
Reference in New Issue
Block a user