Skip to content

Commit

Permalink
Propagate foreign server ops
Browse files Browse the repository at this point in the history
  • Loading branch information
agedemenli committed Dec 23, 2021
1 parent 61b5fb1 commit 042d45b
Show file tree
Hide file tree
Showing 19 changed files with 985 additions and 21 deletions.
5 changes: 5 additions & 0 deletions src/backend/distributed/commands/dependencies.c
Expand Up @@ -288,6 +288,11 @@ GetDependencyCreateDDLCommands(const ObjectAddress *dependency)
return CreateExtensionDDLCommand(dependency);
}

case OCLASS_FOREIGN_SERVER:
{
return GetForeignServerCreateDDLCommand(dependency->objectId);
}

default:
{
break;
Expand Down
65 changes: 65 additions & 0 deletions src/backend/distributed/commands/distribute_object_ops.c
Expand Up @@ -89,6 +89,14 @@ static DistributeObjectOps Any_AlterExtensionContents = {
.address = NULL,
.markDistributed = false,
};
static DistributeObjectOps Any_AlterForeignServer = {
.deparse = DeparseAlterForeignServerStmt,
.qualify = NULL,
.preprocess = PreprocessAlterForeignServerStmt,
.postprocess = NULL,
.address = NULL,
.markDistributed = false,
};
static DistributeObjectOps Any_AlterFunction = {
.deparse = DeparseAlterFunctionStmt,
.qualify = QualifyAlterFunctionStmt,
Expand Down Expand Up @@ -177,6 +185,14 @@ static DistributeObjectOps Any_CreatePolicy = {
.address = NULL,
.markDistributed = false,
};
static DistributeObjectOps Any_CreateForeignServer = {
.deparse = DeparseCreateForeignServerStmt,
.qualify = NULL,
.preprocess = PreprocessCreateForeignServerStmt,
.postprocess = PostprocessCreateForeignServerStmt,
.address = CreateForeignServerStmtObjectAddress,
.markDistributed = true,
};
static DistributeObjectOps Any_CreateStatistics = {
.deparse = DeparseCreateStatisticsStmt,
.qualify = QualifyCreateStatisticsStmt,
Expand Down Expand Up @@ -297,6 +313,30 @@ static DistributeObjectOps Extension_Drop = {
.address = NULL,
.markDistributed = false,
};
static DistributeObjectOps ForeignServer_Drop = {
.deparse = DeparseDropForeignServerStmt,
.qualify = NULL,
.preprocess = PreprocessDropForeignServerStmt,
.postprocess = NULL,
.address = NULL,
.markDistributed = false,
};
static DistributeObjectOps ForeignServer_Rename = {
.deparse = DeparseAlterForeignServerRenameStmt,
.qualify = NULL,
.preprocess = PreprocessRenameForeignServerStmt,
.postprocess = NULL,
.address = NULL,
.markDistributed = false,
};
static DistributeObjectOps ForeignServer_AlterOwner = {
.deparse = DeparseAlterForeignServerOwnerStmt,
.qualify = NULL,
.preprocess = PreprocessAlterForeignServerOwnerStmt,
.postprocess = PostprocessAlterForeignServerOwnerStmt,
.address = AlterForeignServerOwnerStmtObjectAddress,
.markDistributed = false,
};
static DistributeObjectOps ForeignTable_AlterTable = {
.deparse = NULL,
.qualify = NULL,
Expand Down Expand Up @@ -675,6 +715,11 @@ GetDistributeObjectOps(Node *node)
return &Any_AlterFunction;
}

case T_AlterForeignServerStmt:
{
return &Any_AlterForeignServer;
}

case T_AlterObjectDependsStmt:
{
AlterObjectDependsStmt *stmt = castNode(AlterObjectDependsStmt, node);
Expand Down Expand Up @@ -789,6 +834,11 @@ GetDistributeObjectOps(Node *node)
return &Database_AlterOwner;
}

case OBJECT_FOREIGN_SERVER:
{
return &ForeignServer_AlterOwner;
}

case OBJECT_FUNCTION:
{
return &Function_AlterOwner;
Expand Down Expand Up @@ -915,6 +965,11 @@ GetDistributeObjectOps(Node *node)
return &Any_CreateFunction;
}

case T_CreateForeignServerStmt:
{
return &Any_CreateForeignServer;
}

case T_CreatePolicyStmt:
{
return &Any_CreatePolicy;
Expand Down Expand Up @@ -977,6 +1032,11 @@ GetDistributeObjectOps(Node *node)
return &Function_Drop;
}

case OBJECT_FOREIGN_SERVER:
{
return &ForeignServer_Drop;
}

case OBJECT_INDEX:
{
return &Index_Drop;
Expand Down Expand Up @@ -1081,6 +1141,11 @@ GetDistributeObjectOps(Node *node)
return &Collation_Rename;
}

case OBJECT_FOREIGN_SERVER:
{
return &ForeignServer_Rename;
}

case OBJECT_FUNCTION:
{
return &Function_Rename;
Expand Down
2 changes: 1 addition & 1 deletion src/backend/distributed/commands/extension.c
Expand Up @@ -797,7 +797,7 @@ CreateExtensionDDLCommand(const ObjectAddress *extensionAddress)


/*
* RecreateEnumStmt returns a parsetree for a CREATE EXTENSION statement that would
* RecreateExtensionStmt returns a parsetree for a CREATE EXTENSION statement that would
* recreate the given extension on a new node.
*/
static Node *
Expand Down

0 comments on commit 042d45b

Please sign in to comment.