Adds first commit

create_drop_db_gh
gindibay 2023-09-23 01:50:23 +03:00
parent 0dca65c84d
commit 226696e42a
10 changed files with 891 additions and 444 deletions

View File

@ -18,7 +18,7 @@ generated_downgrade_sql_files += $(patsubst %,$(citus_abs_srcdir)/build/sql/%,$(
DATA_built = $(generated_sql_files) DATA_built = $(generated_sql_files)
# directories with source files # directories with source files
SUBDIRS = . commands connection ddl deparser executor metadata operations planner progress relay safeclib shardsplit test transaction utils worker clock SUBDIRS = . commands connection database ddl deparser executor metadata operations planner progress relay safeclib shardsplit test transaction utils worker clock
# enterprise modules # enterprise modules
SUBDIRS += replication SUBDIRS += replication

View File

@ -19,6 +19,7 @@
#include "miscadmin.h" #include "miscadmin.h"
#include "nodes/parsenodes.h" #include "nodes/parsenodes.h"
#include "utils/syscache.h" #include "utils/syscache.h"
#include "utils/builtins.h"
#include "distributed/commands.h" #include "distributed/commands.h"
#include "distributed/commands/utility_hook.h" #include "distributed/commands/utility_hook.h"
@ -28,13 +29,42 @@
#include "distributed/multi_executor.h" #include "distributed/multi_executor.h"
#include "distributed/relation_access_tracking.h" #include "distributed/relation_access_tracking.h"
#include "distributed/worker_transaction.h" #include "distributed/worker_transaction.h"
#include "distributed/deparser.h"
#include "distributed/worker_protocol.h"
#include "distributed/metadata/distobject.h"
#include "distributed/database/database_sharding.h"
#include "distributed/deparse_shard_query.h"
/* macros to add DefElems to a list */
#define DEFELEM_ADD_STRING(options, key, value) { \
DefElem *elem = makeDefElem(key, (Node *) makeString(value), -1); \
options = lappend(options, elem); \
}
#define DEFELEM_ADD_BOOL(options, key, value) { \
DefElem *elem = makeDefElem(key, (Node *) makeBoolean(value), -1); \
options = lappend(options, elem); \
}
#define DEFELEM_ADD_INT(options, key, value) { \
DefElem *elem = makeDefElem(key, (Node *) makeInteger(value), -1); \
options = lappend(options, elem); \
}
static AlterOwnerStmt * RecreateAlterDatabaseOwnerStmt(Oid databaseOid); static AlterOwnerStmt * RecreateAlterDatabaseOwnerStmt(Oid databaseOid);
static List * CreateDDLTaskList(char *command, List *workerNodeList,
bool outsideTransaction);
PG_FUNCTION_INFO_V1(citus_internal_database_command);
static Oid get_database_owner(Oid db_oid); static Oid get_database_owner(Oid db_oid);
List * PreprocessGrantOnDatabaseStmt(Node *node, const char *queryString, List * PreprocessGrantOnDatabaseStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext); ProcessUtilityContext processUtilityContext);
/* controlled via GUC */ /* controlled via GUC */
bool EnableCreateDatabasePropagation = true;
bool EnableAlterDatabaseOwner = true; bool EnableAlterDatabaseOwner = true;
@ -148,6 +178,78 @@ PreprocessGrantOnDatabaseStmt(Node *node, const char *queryString,
return NodeDDLTaskList(NON_COORDINATOR_NODES, commands); return NodeDDLTaskList(NON_COORDINATOR_NODES, commands);
} }
/*
* citus_internal_database_command is an internal UDF to
* create/drop a database in an idempotent maner without
* transaction block restrictions.
*/
Datum
citus_internal_database_command(PG_FUNCTION_ARGS)
{
text *commandText = PG_GETARG_TEXT_P(0);
char *command = text_to_cstring(commandText);
Node *parseTree = ParseTreeNode(command);
set_config_option("citus.enable_ddl_propagation", "off",
(superuser() ? PGC_SUSET : PGC_USERSET), PGC_S_SESSION,
GUC_ACTION_LOCAL, true, 0, false);
set_config_option("citus.enable_create_database_propagation", "off",
(superuser() ? PGC_SUSET : PGC_USERSET), PGC_S_SESSION,
GUC_ACTION_LOCAL, true, 0, false);
if (IsA(parseTree, CreatedbStmt))
{
CreatedbStmt *stmt = castNode(CreatedbStmt, parseTree);
bool missingOk = true;
Oid databaseOid = get_database_oid(stmt->dbname, missingOk);
if (!OidIsValid(databaseOid))
{
createdb(NULL, (CreatedbStmt *) parseTree);
}
else
{
/* TODO: check database properties */
}
}
else if (IsA(parseTree, DropdbStmt))
{
DropdbStmt *stmt = castNode(DropdbStmt, parseTree);
bool missingOk = true;
Oid databaseOid = get_database_oid(stmt->dbname, missingOk);
if (!OidIsValid(databaseOid))
{
/* already dropped? */
}
else
{
/* remove database from pg_dist_object */
ObjectAddress dbAddress = { 0 };
ObjectAddressSet(dbAddress, DatabaseRelationId, databaseOid);
if (IsObjectDistributed(&dbAddress))
{
UnmarkObjectDistributed(&dbAddress);
}
/* remove database from database shards */
DeleteDatabaseShardByDatabaseIdLocally(databaseOid);
DropDatabase(NULL, (DropdbStmt *) parseTree);
}
}
else
{
ereport(ERROR, (errmsg("unsupported command type %d", nodeTag(parseTree))));
}
PG_RETURN_VOID();
}
/* /*
* PreprocessAlterDatabaseStmt is executed before the statement is applied to the local * PreprocessAlterDatabaseStmt is executed before the statement is applied to the local
@ -213,6 +315,35 @@ PreprocessAlterDatabaseRefreshCollStmt(Node *node, const char *queryString,
#endif #endif
/*
* CreateDDLTaskList creates a task list for running a single DDL command.
*/
static List *
CreateDDLTaskList(char *command, List *workerNodeList, bool outsideTransaction)
{
List *commandList = list_make3(DISABLE_DDL_PROPAGATION,
command,
ENABLE_DDL_PROPAGATION);
Task *task = CitusMakeNode(Task);
task->taskType = DDL_TASK;
SetTaskQueryStringList(task, commandList);
task->cannotBeExecutedInTransction = outsideTransaction;
WorkerNode *workerNode = NULL;
foreach_ptr(workerNode, workerNodeList)
{
ShardPlacement *targetPlacement = CitusMakeNode(ShardPlacement);
targetPlacement->nodeName = workerNode->workerName;
targetPlacement->nodePort = workerNode->workerPort;
targetPlacement->groupId = workerNode->groupId;
task->taskPlacementList = lappend(task->taskPlacementList,
targetPlacement);
}
return list_make1(task);
}
/* /*
* PreprocessAlterDatabaseSetStmt is executed before the statement is applied to the local * PreprocessAlterDatabaseSetStmt is executed before the statement is applied to the local
@ -242,3 +373,111 @@ PreprocessAlterDatabaseSetStmt(Node *node, const char *queryString,
return NodeDDLTaskList(NON_COORDINATOR_NODES, commands); return NodeDDLTaskList(NON_COORDINATOR_NODES, commands);
} }
/*
* PostprocessCreatedbStmt creates the plan to synchronize CREATE DATABASE
* across nodes. We use the cannotBeExecutedInTransction option to avoid
* u* sending transaction blocks.
*/
List *
PostprocessCreateDatabaseStmt(Node *node, const char *queryString)
{
if (!EnableCreateDatabasePropagation || !ShouldPropagate())
{
return NIL;
}
CreatedbStmt *stmt = castNode(CreatedbStmt, node);
char *databaseName = stmt->dbname;
bool missingOk = false;
Oid databaseOid = get_database_oid(databaseName, missingOk);
/*
* TODO: try to reuse regular DDL infrastructure
*
* We do not do this right now because of the AssignDatabaseToShard at the end.
*/
List *workerNodes = TargetWorkerSetNodeList(NON_COORDINATOR_METADATA_NODES, RowShareLock);
if (list_length(workerNodes) > 0)
{
char *createDatabaseCommand = DeparseTreeNode(node);
StringInfo internalCreateCommand = makeStringInfo();
appendStringInfo(internalCreateCommand,
"SELECT pg_catalog.citus_internal_database_command(%s)",
quote_literal_cstr(createDatabaseCommand));
/*
* For the moment, we run CREATE DATABASE in 2PC, though that prevents
* us from immediately doing a pg_dump | pg_restore when dealing with
* a remote template database.
*/
bool outsideTransaction = false;
List *taskList = CreateDDLTaskList(internalCreateCommand->data, workerNodes,
outsideTransaction);
bool localExecutionSupported = false;
ExecuteUtilityTaskList(taskList, localExecutionSupported);
}
/* synchronize pg_dist_object records */
ObjectAddress dbAddress = { 0 };
ObjectAddressSet(dbAddress, DatabaseRelationId, databaseOid);
MarkObjectDistributed(&dbAddress);
return NIL;
}
List *
PreprocessDropDatabaseStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{
if (!EnableCreateDatabasePropagation || !ShouldPropagate())
{
return NIL;
}
DropdbStmt *stmt = (DropdbStmt *) node;
char *databaseName = stmt->dbname;
bool missingOk = true;
Oid databaseOid = get_database_oid(databaseName, missingOk);
if (databaseOid == InvalidOid)
{
/* let regular ProcessUtility deal with IF NOT EXISTS */
return NIL;
}
ObjectAddress dbAddress = { 0 };
ObjectAddressSet(dbAddress, DatabaseRelationId, databaseOid);
if (!IsObjectDistributed(&dbAddress))
{
return NIL;
}
List *workerNodes = TargetWorkerSetNodeList(NON_COORDINATOR_METADATA_NODES, RowShareLock);
if (list_length(workerNodes) == 0)
{
return NIL;
}
char *dropDatabaseCommand = DeparseTreeNode(node);
StringInfo internalDropCommand = makeStringInfo();
appendStringInfo(internalDropCommand,
"SELECT pg_catalog.citus_internal_database_command(%s)",
quote_literal_cstr(dropDatabaseCommand));
/* we execute here to avoid EnsureCoordinator check in ExecuteDistributedDDLJob */
bool outsideTransaction = false;
List *taskList = CreateDDLTaskList(internalDropCommand->data, workerNodes,
outsideTransaction);
bool localExecutionSupported = false;
ExecuteUtilityTaskList(taskList, localExecutionSupported);
return NIL;
}

View File

@ -466,6 +466,28 @@ static DistributeObjectOps Database_Alter = {
.markDistributed = false, .markDistributed = false,
}; };
static DistributeObjectOps Database_Create = {
.deparse = DeparseCreateDatabaseStmt,
.qualify = NULL,
.preprocess = NULL,
.postprocess = PostprocessCreateDatabaseStmt,
.objectType = OBJECT_DATABASE,
.operationType = DIST_OPS_CREATE,
.address = NULL,
.markDistributed = false,
};
static DistributeObjectOps Database_Drop = {
.deparse = DeparseDropDatabaseStmt,
.qualify = NULL,
.preprocess = PreprocessDropDatabaseStmt,
.postprocess = NULL,
.objectType = OBJECT_DATABASE,
.operationType = DIST_OPS_DROP,
.address = NULL,
.markDistributed = false,
};
#if PG_VERSION_NUM >= PG_VERSION_15 #if PG_VERSION_NUM >= PG_VERSION_15
static DistributeObjectOps Database_RefreshColl = { static DistributeObjectOps Database_RefreshColl = {
.deparse = DeparseAlterDatabaseRefreshCollStmt, .deparse = DeparseAlterDatabaseRefreshCollStmt,
@ -1333,6 +1355,15 @@ GetDistributeObjectOps(Node *node)
{ {
return &Database_Alter; return &Database_Alter;
} }
case T_CreatedbStmt:
{
return &Database_Create;
}
case T_DropdbStmt:
{
return &Database_Drop;
}
#if PG_VERSION_NUM >= PG_VERSION_15 #if PG_VERSION_NUM >= PG_VERSION_15
case T_AlterDatabaseRefreshCollStmt: case T_AlterDatabaseRefreshCollStmt:

View File

@ -0,0 +1,53 @@
/*
* database_sharding.h
*
* Data structure definition for managing backend data and related function
*
* Copyright (c) Microsoft, Inc.
*/
#ifndef DATABASE_SHARDING_H
#define DATABASE_SHARDING_H
#include "tcop/utility.h"
/* attributes of citus_catalog.database_shard */
#define Natts_database_shard 3
#define Anum_database_shard_database_id 1
#define Anum_database_shard_node_group_id 2
#define Anum_database_shard_is_available 3
typedef struct DatabaseShard
{
/* database oid */
Oid databaseOid;
/* node group on which the database shard is placed */
int nodeGroupId;
/* whether the database shard is available */
bool isAvailable;
} DatabaseShard;
/* citus.enable_database_sharding setting */
extern bool EnableDatabaseSharding;
void PreProcessUtilityInDatabaseShard(Node *parseTree, const char *queryString,
ProcessUtilityContext context,
bool *runPreviousUtilityHook);
void PostProcessUtilityInDatabaseShard(Node *parseTree, const char *queryString,
ProcessUtilityContext context);
bool DatabaseShardingEnabled(void);
void AssignDatabaseToShard(Oid databaseOid);
void UpdateDatabaseShard(Oid databaseOid, int targetNodeGroupId);
void DeleteDatabaseShardByDatabaseIdLocally(Oid databaseOid);
DatabaseShard * GetDatabaseShardByOid(Oid databaseOid);
List * ListDatabaseShards(void);
int64 CitusDatabaseSize(Oid databaseId);
char * InsertDatabaseShardAssignmentCommand(Oid databaseOid, int nodeGroupId);
#endif

View File

@ -24,7 +24,7 @@
#include "distributed/deparser.h" #include "distributed/deparser.h"
#include "distributed/log_utils.h" #include "distributed/log_utils.h"
#include "parser/parse_type.h" #include "parser/parse_type.h"
#include "distributed/listutils.h"
static void AppendAlterDatabaseOwnerStmt(StringInfo buf, AlterOwnerStmt *stmt); static void AppendAlterDatabaseOwnerStmt(StringInfo buf, AlterOwnerStmt *stmt);
static void AppendAlterDatabaseStmt(StringInfo buf, AlterDatabaseStmt *stmt); static void AppendAlterDatabaseStmt(StringInfo buf, AlterDatabaseStmt *stmt);
@ -44,7 +44,6 @@ DeparseAlterDatabaseOwnerStmt(Node *node)
return str.data; return str.data;
} }
static void static void
AppendAlterDatabaseOwnerStmt(StringInfo buf, AlterOwnerStmt *stmt) AppendAlterDatabaseOwnerStmt(StringInfo buf, AlterOwnerStmt *stmt)
{ {
@ -56,7 +55,6 @@ AppendAlterDatabaseOwnerStmt(StringInfo buf, AlterOwnerStmt *stmt)
RoleSpecString(stmt->newowner, true)); RoleSpecString(stmt->newowner, true));
} }
static void static void
AppendGrantDatabases(StringInfo buf, GrantStmt *stmt) AppendGrantDatabases(StringInfo buf, GrantStmt *stmt)
{ {
@ -74,7 +72,6 @@ AppendGrantDatabases(StringInfo buf, GrantStmt *stmt)
} }
} }
static void static void
AppendGrantOnDatabaseStmt(StringInfo buf, GrantStmt *stmt) AppendGrantOnDatabaseStmt(StringInfo buf, GrantStmt *stmt)
{ {
@ -87,14 +84,12 @@ AppendGrantOnDatabaseStmt(StringInfo buf, GrantStmt *stmt)
AppendGrantSharedSuffix(buf, stmt); AppendGrantSharedSuffix(buf, stmt);
} }
static void static void
AppendDefElemConnLimit(StringInfo buf, DefElem *def) AppendDefElemConnLimit(StringInfo buf, DefElem *def)
{ {
appendStringInfo(buf, " CONNECTION LIMIT %ld", (long int)defGetNumeric(def)); appendStringInfo(buf, " CONNECTION LIMIT %ld", (long int)defGetNumeric(def));
} }
static void static void
AppendAlterDatabaseStmt(StringInfo buf, AlterDatabaseStmt *stmt) AppendAlterDatabaseStmt(StringInfo buf, AlterDatabaseStmt *stmt)
{ {
@ -133,7 +128,6 @@ AppendAlterDatabaseStmt(StringInfo buf, AlterDatabaseStmt *stmt)
appendStringInfo(buf, ";"); appendStringInfo(buf, ";");
} }
char * char *
DeparseGrantOnDatabaseStmt(Node *node) DeparseGrantOnDatabaseStmt(Node *node)
{ {
@ -148,7 +142,6 @@ DeparseGrantOnDatabaseStmt(Node *node)
return str.data; return str.data;
} }
char * char *
DeparseAlterDatabaseStmt(Node *node) DeparseAlterDatabaseStmt(Node *node)
{ {
@ -162,7 +155,6 @@ DeparseAlterDatabaseStmt(Node *node)
return str.data; return str.data;
} }
#if PG_VERSION_NUM >= PG_VERSION_15 #if PG_VERSION_NUM >= PG_VERSION_15
char * char *
DeparseAlterDatabaseRefreshCollStmt(Node *node) DeparseAlterDatabaseRefreshCollStmt(Node *node)
@ -179,7 +171,6 @@ DeparseAlterDatabaseRefreshCollStmt(Node *node)
return str.data; return str.data;
} }
#endif #endif
static void static void
@ -192,7 +183,6 @@ AppendAlterDatabaseSetStmt(StringInfo buf, AlterDatabaseSetStmt *stmt)
AppendVariableSet(buf, varSetStmt); AppendVariableSet(buf, varSetStmt);
} }
char * char *
DeparseAlterDatabaseSetStmt(Node *node) DeparseAlterDatabaseSetStmt(Node *node)
{ {
@ -205,3 +195,181 @@ DeparseAlterDatabaseSetStmt(Node *node)
return str.data; return str.data;
} }
char *
DeparseCreateDatabaseSetStmt(Node *node)
{
CreatedbStmt *stmt = castNode(CreatedbStmt, node);
StringInfoData str = {0};
initStringInfo(&str);
AppendCreatedbStmt(&str, stmt);
return str.data;
}
static void
AppendCreatedbStmt(StringInfo buf, CreatedbStmt *stmt)
{
appendStringInfo(buf,
"CREATE DATABASE %s",
quote_identifier(stmt->dbname));
DefElem *option = NULL;
foreach_ptr(option, stmt->options)
{
if (strcmp(option->defname, "tablespace") == 0)
{
char *tablespaceName = defGetString(option);
appendStringInfo(buf, " TABLESPACE %s",
quote_identifier(tablespaceName));
}
else if (strcmp(option->defname, "owner") == 0)
{
char *owner = defGetString(option);
appendStringInfo(buf, " OWNER %s",
quote_identifier(owner));
}
else if (strcmp(option->defname, "template") == 0)
{
char *template = defGetString(option);
appendStringInfo(buf, " TEMPLATE %s",
quote_identifier(template));
}
else if (strcmp(option->defname, "encoding") == 0)
{
char *encoding = defGetString(option);
appendStringInfo(buf, " ENCODING %s",
quote_literal_cstr(encoding));
}
else if (strcmp(option->defname, "locale") == 0)
{
char *locale = defGetString(option);
appendStringInfo(buf, " LOCALE %s",
quote_literal_cstr(locale));
}
else if (strcmp(option->defname, "lc_collate") == 0)
{
char *lc_collate = defGetString(option);
appendStringInfo(buf, " LC_COLLATE %s",
quote_literal_cstr(lc_collate));
}
else if (strcmp(option->defname, "lc_ctype") == 0)
{
char *lc_ctype = defGetString(option);
appendStringInfo(buf, " LC_CTYPE %s",
quote_literal_cstr(lc_ctype));
}
else if (strcmp(option->defname, "icu_locale") == 0)
{
char *icuLocale = defGetString(option);
appendStringInfo(buf, " ICU_LOCALE %s",
quote_literal_cstr(icuLocale));
}
else if (strcmp(option->defname, "locale_provider") == 0)
{
char *localeProvider = defGetString(option);
appendStringInfo(buf, " LOCALE_PROVIDER %s",
quote_literal_cstr(localeProvider));
}
else if (strcmp(option->defname, "is_template") == 0)
{
bool isTemplate = defGetBoolean(option);
appendStringInfo(buf, " IS_TEMPLATE %s",
isTemplate ? "true" : "false");
}
else if (strcmp(option->defname, "allow_connections") == 0)
{
bool allowConnections = defGetBoolean(option);
appendStringInfo(buf, " ALLOW_CONNECTIONS %s",
allowConnections ? "true" : "false");
}
else if (strcmp(option->defname, "connection_limit") == 0)
{
int connectionLimit = defGetInt32(option);
appendStringInfo(buf, " CONNECTION_LIMIT %d", connectionLimit);
}
#if PG_VERSION_NUM >= PG_VERSION_15
else if (strcmp(option->defname, "collation_version") == 0)
{
char *collationVersion = defGetString(option);
appendStringInfo(buf, " COLLATION_VERSION %s",
quote_literal_cstr(collationVersion));
}
else if (strcmp(option->defname, "oid") == 0)
{
Oid objectId = defGetObjectId(option);
appendStringInfo(buf, " OID %d", objectId);
}
else if (strcmp(option->defname, "strategy") == 0)
{
char *strategy = defGetString(option);
appendStringInfo(buf, " STRATEGY %s",
quote_literal_cstr(strategy));
}
#endif
else if (strcmp(option->defname, "location") == 0)
{
/* deprecated option */
}
else
{
ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("unrecognized CREATE DATABASE option \"%s\"",
option->defname)));
}
}
}
char *
DeparseDropDatabaseStmt(Node *node)
{
DropdbStmt *stmt = castNode(DropdbStmt, node);
StringInfoData str = { 0 };
initStringInfo(&str);
AppendDropDatabaseStmt(&str, stmt);
return str.data;
}
static void
AppendDropDatabaseStmt(StringInfo buf, DropdbStmt *stmt)
{
appendStringInfo(buf,
"DROP DATABASE %s",
quote_identifier(stmt->dbname));
DefElem *option = NULL;
foreach_ptr(option, stmt->options)
{
if (strcmp(option->defname, "force") == 0)
{
appendStringInfo(buf, " FORCE");
}
else
{
ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR),
errmsg("unrecognized DROP DATABASE option \"%s\"",
option->defname)));
}
}
}

View File

@ -1,3 +1,14 @@
-- citus--12.1-1--12.2-1 -- citus--12.1-1--12.2-1
/*
* citus_internal_database_command creates a database according to the given command.
*/
CREATE OR REPLACE FUNCTION pg_catalog.citus_internal_database_command(command text)
RETURNS void
LANGUAGE C
STRICT
AS 'MODULE_PATHNAME', $$citus_internal_database_command$$;
COMMENT ON FUNCTION pg_catalog.citus_internal_database_command(text) IS
'run a database command without transaction block restrictions';
-- bump version to 12.2-1 -- bump version to 12.2-1

View File

@ -1,2 +1,3 @@
-- citus--12.2-1--12.1-1 -- citus--12.2-1--12.1-1
DROP FUNCTION pg_catalog.citus_internal_database_command(text);
-- this is an empty downgrade path since citus--12.2-1--12.1-1.sql is empty for now -- this is an empty downgrade path since citus--12.2-1--12.1-1.sql is empty for now

View File

@ -22,7 +22,6 @@
#include "tcop/utility.h" #include "tcop/utility.h"
#include "utils/acl.h" #include "utils/acl.h"
extern bool AddAllLocalTablesToMetadata; extern bool AddAllLocalTablesToMetadata;
extern bool EnableSchemaBasedSharding; extern bool EnableSchemaBasedSharding;
@ -58,7 +57,6 @@ typedef enum DistOpsOperationType
DIST_OPS_DROP, DIST_OPS_DROP,
} DistOpsOperationType; } DistOpsOperationType;
/* /*
* DistributeObjectOps specifies handlers for node/object type pairs. * DistributeObjectOps specifies handlers for node/object type pairs.
* Instances of this type should all be declared in deparse.c. * Instances of this type should all be declared in deparse.c.
@ -140,7 +138,6 @@ typedef enum ExtractForeignKeyConstraintsMode
INCLUDE_SINGLE_SHARD_TABLES INCLUDE_SINGLE_SHARD_TABLES
} ExtractForeignKeyConstraintMode; } ExtractForeignKeyConstraintMode;
/* /*
* Flags that can be passed to GetForeignKeyIdsForColumn to * Flags that can be passed to GetForeignKeyIdsForColumn to
* indicate whether relationId argument should match: * indicate whether relationId argument should match:
@ -159,7 +156,6 @@ typedef enum SearchForeignKeyColumnFlags
/* callers can also pass union of above flags */ /* callers can also pass union of above flags */
} SearchForeignKeyColumnFlags; } SearchForeignKeyColumnFlags;
typedef enum TenantOperation typedef enum TenantOperation
{ {
TENANT_UNDISTRIBUTE_TABLE = 0, TENANT_UNDISTRIBUTE_TABLE = 0,
@ -189,35 +185,27 @@ extern List * PostprocessAlterDistributedObjectStmt(Node *stmt, const char *quer
extern List *PreprocessDropDistributedObjectStmt(Node *node, const char *queryString, extern List *PreprocessDropDistributedObjectStmt(Node *node, const char *queryString,
ProcessUtilityContext ProcessUtilityContext
processUtilityContext); processUtilityContext);
extern List * DropTextSearchConfigObjectAddress(Node *node, bool missing_ok, bool extern List *DropTextSearchConfigObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
isPostprocess); extern List *DropTextSearchDictObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
extern List * DropTextSearchDictObjectAddress(Node *node, bool missing_ok, bool
isPostprocess);
/* index.c */ /* index.c */
typedef void (*PGIndexProcessor)(Form_pg_index, List **, int); typedef void (*PGIndexProcessor)(Form_pg_index, List **, int);
/* call.c */ /* call.c */
extern bool CallDistributedProcedureRemotely(CallStmt *callStmt, DestReceiver *dest); extern bool CallDistributedProcedureRemotely(CallStmt *callStmt, DestReceiver *dest);
/* collation.c - forward declarations */ /* collation.c - forward declarations */
extern char *CreateCollationDDL(Oid collationId); extern char *CreateCollationDDL(Oid collationId);
extern List *CreateCollationDDLsIdempotent(Oid collationId); extern List *CreateCollationDDLsIdempotent(Oid collationId);
extern List * AlterCollationOwnerObjectAddress(Node *stmt, bool missing_ok, bool extern List *AlterCollationOwnerObjectAddress(Node *stmt, bool missing_ok, bool isPostprocess);
isPostprocess); extern List *RenameCollationStmtObjectAddress(Node *stmt, bool missing_ok, bool isPostprocess);
extern List * RenameCollationStmtObjectAddress(Node *stmt, bool missing_ok, bool
isPostprocess);
extern List *AlterCollationSchemaStmtObjectAddress(Node *stmt, extern List *AlterCollationSchemaStmtObjectAddress(Node *stmt,
bool missing_ok, bool isPostprocess); bool missing_ok, bool isPostprocess);
extern char *GenerateBackupNameForCollationCollision(const ObjectAddress *address); extern char *GenerateBackupNameForCollationCollision(const ObjectAddress *address);
extern List * DefineCollationStmtObjectAddress(Node *stmt, bool missing_ok, bool extern List *DefineCollationStmtObjectAddress(Node *stmt, bool missing_ok, bool isPostprocess);
isPostprocess);
/* database.c - forward declarations */ /* database.c - forward declarations */
extern List * AlterDatabaseOwnerObjectAddress(Node *node, bool missing_ok, bool extern List *AlterDatabaseOwnerObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
isPostprocess);
extern List *DatabaseOwnerDDLCommands(const ObjectAddress *address); extern List *DatabaseOwnerDDLCommands(const ObjectAddress *address);
extern List *PreprocessGrantOnDatabaseStmt(Node *node, const char *queryString, extern List *PreprocessGrantOnDatabaseStmt(Node *node, const char *queryString,
@ -230,27 +218,23 @@ extern List * PreprocessAlterDatabaseRefreshCollStmt(Node *node, const char *que
ProcessUtilityContext ProcessUtilityContext
processUtilityContext); processUtilityContext);
extern List *PreprocessAlterDatabaseSetStmt(Node *node, const char *queryString, extern List *PreprocessAlterDatabaseSetStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext); ProcessUtilityContext processUtilityContext);
extern List *PostprocessCreateDatabaseStmt(Node *node, const char *queryString);
extern List *PreprocessDropDatabaseStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext);
/* domain.c - forward declarations */ /* domain.c - forward declarations */
extern List * CreateDomainStmtObjectAddress(Node *node, bool missing_ok, bool extern List *CreateDomainStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
isPostprocess); extern List *AlterDomainStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
extern List * AlterDomainStmtObjectAddress(Node *node, bool missing_ok, bool
isPostprocess);
extern List *DomainRenameConstraintStmtObjectAddress(Node *node, extern List *DomainRenameConstraintStmtObjectAddress(Node *node,
bool missing_ok, bool bool missing_ok, bool isPostprocess);
isPostprocess); extern List *AlterDomainOwnerStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
extern List * AlterDomainOwnerStmtObjectAddress(Node *node, bool missing_ok, bool extern List *RenameDomainStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
isPostprocess);
extern List * RenameDomainStmtObjectAddress(Node *node, bool missing_ok, bool
isPostprocess);
extern CreateDomainStmt *RecreateDomainStmt(Oid domainOid); extern CreateDomainStmt *RecreateDomainStmt(Oid domainOid);
extern Oid get_constraint_typid(Oid conoid); extern Oid get_constraint_typid(Oid conoid);
/* extension.c - forward declarations */ /* extension.c - forward declarations */
extern bool IsDropCitusExtensionStmt(Node *parsetree); extern bool IsDropCitusExtensionStmt(Node *parsetree);
extern List *GetDependentFDWsToExtension(Oid extensionId); extern List *GetDependentFDWsToExtension(Oid extensionId);
@ -329,34 +313,26 @@ extern Oid GetReferencedTableId(Oid foreignKeyId);
extern Oid GetReferencingTableId(Oid foreignKeyId); extern Oid GetReferencingTableId(Oid foreignKeyId);
extern bool RelationInvolvedInAnyNonInheritedForeignKeys(Oid relationId); extern bool RelationInvolvedInAnyNonInheritedForeignKeys(Oid relationId);
/* foreign_data_wrapper.c - forward declarations */ /* foreign_data_wrapper.c - forward declarations */
extern List *PreprocessGrantOnFDWStmt(Node *node, const char *queryString, extern List *PreprocessGrantOnFDWStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext); ProcessUtilityContext processUtilityContext);
extern Acl *GetPrivilegesForFDW(Oid FDWOid); extern Acl *GetPrivilegesForFDW(Oid FDWOid);
/* foreign_server.c - forward declarations */ /* foreign_server.c - forward declarations */
extern List *PreprocessGrantOnForeignServerStmt(Node *node, const char *queryString, extern List *PreprocessGrantOnForeignServerStmt(Node *node, const char *queryString,
ProcessUtilityContext ProcessUtilityContext
processUtilityContext); processUtilityContext);
extern List * CreateForeignServerStmtObjectAddress(Node *node, bool missing_ok, bool extern List *CreateForeignServerStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
isPostprocess); extern List *AlterForeignServerStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
extern List * AlterForeignServerStmtObjectAddress(Node *node, bool missing_ok, bool extern List *RenameForeignServerStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
isPostprocess); extern List *AlterForeignServerOwnerStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
extern List * RenameForeignServerStmtObjectAddress(Node *node, bool missing_ok, bool
isPostprocess);
extern List * AlterForeignServerOwnerStmtObjectAddress(Node *node, bool
missing_ok, bool isPostprocess);
extern List *GetForeignServerCreateDDLCommand(Oid serverId); extern List *GetForeignServerCreateDDLCommand(Oid serverId);
/* foreign_table.c - forward declarations */ /* foreign_table.c - forward declarations */
extern List *PreprocessAlterForeignTableSchemaStmt(Node *node, const char *queryString, extern List *PreprocessAlterForeignTableSchemaStmt(Node *node, const char *queryString,
ProcessUtilityContext ProcessUtilityContext
processUtilityContext); processUtilityContext);
/* function.c - forward declarations */ /* function.c - forward declarations */
extern List *PreprocessCreateFunctionStmt(Node *stmt, const char *queryString, extern List *PreprocessCreateFunctionStmt(Node *stmt, const char *queryString,
ProcessUtilityContext processUtilityContext); ProcessUtilityContext processUtilityContext);
@ -386,14 +362,12 @@ extern List * PreprocessGrantOnFunctionStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext); ProcessUtilityContext processUtilityContext);
extern List *PostprocessGrantOnFunctionStmt(Node *node, const char *queryString); extern List *PostprocessGrantOnFunctionStmt(Node *node, const char *queryString);
/* grant.c - forward declarations */ /* grant.c - forward declarations */
extern List *PreprocessGrantStmt(Node *node, const char *queryString, extern List *PreprocessGrantStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext); ProcessUtilityContext processUtilityContext);
extern void deparsePrivileges(StringInfo privsString, GrantStmt *grantStmt); extern void deparsePrivileges(StringInfo privsString, GrantStmt *grantStmt);
extern void deparseGrantees(StringInfo granteesString, GrantStmt *grantStmt); extern void deparseGrantees(StringInfo granteesString, GrantStmt *grantStmt);
/* index.c - forward declarations */ /* index.c - forward declarations */
extern bool IsIndexRenameStmt(RenameStmt *renameStmt); extern bool IsIndexRenameStmt(RenameStmt *renameStmt);
extern List *PreprocessIndexStmt(Node *createIndexStatement, extern List *PreprocessIndexStmt(Node *createIndexStatement,
@ -416,13 +390,11 @@ extern List * PostprocessIndexStmt(Node *node,
const char *queryString); const char *queryString);
extern void ErrorIfUnsupportedAlterIndexStmt(AlterTableStmt *alterTableStatement); extern void ErrorIfUnsupportedAlterIndexStmt(AlterTableStmt *alterTableStatement);
extern void MarkIndexValid(IndexStmt *indexStmt); extern void MarkIndexValid(IndexStmt *indexStmt);
extern List * ExecuteFunctionOnEachTableIndex(Oid relationId, PGIndexProcessor extern List *ExecuteFunctionOnEachTableIndex(Oid relationId, PGIndexProcessor pgIndexProcessor, int flags);
pgIndexProcessor, int flags);
extern bool IsReindexWithParam_compat(ReindexStmt *stmt, char *paramName); extern bool IsReindexWithParam_compat(ReindexStmt *stmt, char *paramName);
/* objectaddress.c - forward declarations */ /* objectaddress.c - forward declarations */
extern List * CreateExtensionStmtObjectAddress(Node *stmt, bool missing_ok, bool extern List *CreateExtensionStmtObjectAddress(Node *stmt, bool missing_ok, bool isPostprocess);
isPostprocess);
/* owned.c - forward declarations */ /* owned.c - forward declarations */
extern List *PreprocessDropOwnedStmt(Node *node, const char *queryString, extern List *PreprocessDropOwnedStmt(Node *node, const char *queryString,
@ -442,10 +414,8 @@ extern void CreatePolicyEventExtendNames(CreatePolicyStmt *stmt, const char *sch
uint64 shardId); uint64 shardId);
extern void AlterPolicyEventExtendNames(AlterPolicyStmt *stmt, const char *schemaName, extern void AlterPolicyEventExtendNames(AlterPolicyStmt *stmt, const char *schemaName,
uint64 shardId); uint64 shardId);
extern void RenamePolicyEventExtendNames(RenameStmt *stmt, const char *schemaName, uint64 extern void RenamePolicyEventExtendNames(RenameStmt *stmt, const char *schemaName, uint64 shardId);
shardId); extern void DropPolicyEventExtendNames(DropStmt *stmt, const char *schemaName, uint64 shardId);
extern void DropPolicyEventExtendNames(DropStmt *stmt, const char *schemaName, uint64
shardId);
extern void AddRangeTableEntryToQueryCompat(ParseState *parseState, Relation relation); extern void AddRangeTableEntryToQueryCompat(ParseState *parseState, Relation relation);
@ -474,7 +444,6 @@ extern void ErrorIfUnsupportedRenameStmt(RenameStmt *renameStmt);
extern List *PreprocessRenameAttributeStmt(Node *stmt, const char *queryString, extern List *PreprocessRenameAttributeStmt(Node *stmt, const char *queryString,
ProcessUtilityContext processUtilityContext); ProcessUtilityContext processUtilityContext);
/* role.c - forward declarations*/ /* role.c - forward declarations*/
extern List *PostprocessAlterRoleStmt(Node *stmt, const char *queryString); extern List *PostprocessAlterRoleStmt(Node *stmt, const char *queryString);
extern List *PreprocessAlterRoleSetStmt(Node *stmt, const char *queryString, extern List *PreprocessAlterRoleSetStmt(Node *stmt, const char *queryString,
@ -496,8 +465,7 @@ extern List * PreprocessGrantRoleStmt(Node *stmt, const char *queryString,
ProcessUtilityContext processUtilityContext); ProcessUtilityContext processUtilityContext);
extern List *PostprocessGrantRoleStmt(Node *stmt, const char *queryString); extern List *PostprocessGrantRoleStmt(Node *stmt, const char *queryString);
extern List *GenerateCreateOrAlterRoleCommand(Oid roleOid); extern List *GenerateCreateOrAlterRoleCommand(Oid roleOid);
extern List * CreateRoleStmtObjectAddress(Node *stmt, bool missing_ok, bool extern List *CreateRoleStmtObjectAddress(Node *stmt, bool missing_ok, bool isPostprocess);
isPostprocess);
extern List * RenameRoleStmtObjectAddress(Node *stmt, bool missing_ok, bool extern List * RenameRoleStmtObjectAddress(Node *stmt, bool missing_ok, bool
isPostprocess); isPostprocess);
@ -514,12 +482,10 @@ extern List * PreprocessAlterObjectSchemaStmt(Node *alterObjectSchemaStmt,
const char *alterObjectSchemaCommand); const char *alterObjectSchemaCommand);
extern List *PreprocessGrantOnSchemaStmt(Node *node, const char *queryString, extern List *PreprocessGrantOnSchemaStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext); ProcessUtilityContext processUtilityContext);
extern List * CreateSchemaStmtObjectAddress(Node *node, bool missing_ok, bool extern List *CreateSchemaStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
isPostprocess);
extern List *AlterSchemaOwnerStmtObjectAddress(Node *node, bool missing_ok, extern List *AlterSchemaOwnerStmtObjectAddress(Node *node, bool missing_ok,
bool isPostprocess); bool isPostprocess);
extern List * AlterSchemaRenameStmtObjectAddress(Node *node, bool missing_ok, bool extern List *AlterSchemaRenameStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
isPostprocess);
/* sequence.c - forward declarations */ /* sequence.c - forward declarations */
extern List *PreprocessAlterSequenceStmt(Node *node, const char *queryString, extern List *PreprocessAlterSequenceStmt(Node *node, const char *queryString,
@ -540,25 +506,19 @@ extern List * PreprocessSequenceAlterTableStmt(Node *node, const char *queryStri
#endif #endif
extern List *PreprocessDropSequenceStmt(Node *node, const char *queryString, extern List *PreprocessDropSequenceStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext); ProcessUtilityContext processUtilityContext);
extern List * SequenceDropStmtObjectAddress(Node *stmt, bool missing_ok, bool extern List *SequenceDropStmtObjectAddress(Node *stmt, bool missing_ok, bool isPostprocess);
isPostprocess);
extern List *PreprocessRenameSequenceStmt(Node *node, const char *queryString, extern List *PreprocessRenameSequenceStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext); ProcessUtilityContext processUtilityContext);
extern List *PreprocessGrantOnSequenceStmt(Node *node, const char *queryString, extern List *PreprocessGrantOnSequenceStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext); ProcessUtilityContext processUtilityContext);
extern List *PostprocessGrantOnSequenceStmt(Node *node, const char *queryString); extern List *PostprocessGrantOnSequenceStmt(Node *node, const char *queryString);
extern List * AlterSequenceStmtObjectAddress(Node *node, bool missing_ok, bool extern List *AlterSequenceStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
isPostprocess); extern List *AlterSequenceSchemaStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
extern List * AlterSequenceSchemaStmtObjectAddress(Node *node, bool missing_ok, bool extern List *AlterSequenceOwnerStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
isPostprocess);
extern List * AlterSequenceOwnerStmtObjectAddress(Node *node, bool missing_ok, bool
isPostprocess);
#if (PG_VERSION_NUM >= PG_VERSION_15) #if (PG_VERSION_NUM >= PG_VERSION_15)
extern List * AlterSequencePersistenceStmtObjectAddress(Node *node, bool missing_ok, bool extern List *AlterSequencePersistenceStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
isPostprocess);
#endif #endif
extern List * RenameSequenceStmtObjectAddress(Node *node, bool missing_ok, bool extern List *RenameSequenceStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
isPostprocess);
extern void ErrorIfUnsupportedSeqStmt(CreateSeqStmt *createSeqStmt); extern void ErrorIfUnsupportedSeqStmt(CreateSeqStmt *createSeqStmt);
extern void ErrorIfDistributedAlterSeqOwnedBy(AlterSeqStmt *alterSeqStmt); extern void ErrorIfDistributedAlterSeqOwnedBy(AlterSeqStmt *alterSeqStmt);
extern char *GenerateBackupNameForSequenceCollision(const ObjectAddress *address); extern char *GenerateBackupNameForSequenceCollision(const ObjectAddress *address);
@ -569,12 +529,10 @@ extern void RenameExistingSequenceWithDifferentTypeIfExists(RangeVar *sequence,
extern List *PreprocessCreateStatisticsStmt(Node *node, const char *queryString, extern List *PreprocessCreateStatisticsStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext); ProcessUtilityContext processUtilityContext);
extern List *PostprocessCreateStatisticsStmt(Node *node, const char *queryString); extern List *PostprocessCreateStatisticsStmt(Node *node, const char *queryString);
extern List * CreateStatisticsStmtObjectAddress(Node *node, bool missingOk, bool extern List *CreateStatisticsStmtObjectAddress(Node *node, bool missingOk, bool isPostprocess);
isPostprocess);
extern List *PreprocessDropStatisticsStmt(Node *node, const char *queryString, extern List *PreprocessDropStatisticsStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext); ProcessUtilityContext processUtilityContext);
extern List * DropStatisticsObjectAddress(Node *node, bool missing_ok, bool extern List *DropStatisticsObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
isPostprocess);
extern List *PreprocessAlterStatisticsRenameStmt(Node *node, const char *queryString, extern List *PreprocessAlterStatisticsRenameStmt(Node *node, const char *queryString,
ProcessUtilityContext ProcessUtilityContext
processUtilityContext); processUtilityContext);
@ -582,8 +540,7 @@ extern List * PreprocessAlterStatisticsSchemaStmt(Node *node, const char *queryS
ProcessUtilityContext ProcessUtilityContext
processUtilityContext); processUtilityContext);
extern List *PostprocessAlterStatisticsSchemaStmt(Node *node, const char *queryString); extern List *PostprocessAlterStatisticsSchemaStmt(Node *node, const char *queryString);
extern List * AlterStatisticsSchemaStmtObjectAddress(Node *node, bool missingOk, bool extern List *AlterStatisticsSchemaStmtObjectAddress(Node *node, bool missingOk, bool isPostprocess);
isPostprocess);
extern List *PreprocessAlterStatisticsStmt(Node *node, const char *queryString, extern List *PreprocessAlterStatisticsStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext); ProcessUtilityContext processUtilityContext);
extern List *PreprocessAlterStatisticsOwnerStmt(Node *node, const char *queryString, extern List *PreprocessAlterStatisticsOwnerStmt(Node *node, const char *queryString,
@ -597,7 +554,6 @@ extern List * GetAlterIndexStatisticsCommands(Oid indexOid);
/* subscription.c - forward declarations */ /* subscription.c - forward declarations */
extern Node *ProcessCreateSubscriptionStmt(CreateSubscriptionStmt *createSubStmt); extern Node *ProcessCreateSubscriptionStmt(CreateSubscriptionStmt *createSubStmt);
/* table.c - forward declarations */ /* table.c - forward declarations */
extern List *PreprocessDropTableStmt(Node *stmt, const char *queryString, extern List *PreprocessDropTableStmt(Node *stmt, const char *queryString,
ProcessUtilityContext processUtilityContext); ProcessUtilityContext processUtilityContext);
@ -647,36 +603,27 @@ extern List * GetCreateTextSearchDictionaryStatements(const ObjectAddress *addre
extern List *CreateTextSearchConfigDDLCommandsIdempotent(const ObjectAddress *address); extern List *CreateTextSearchConfigDDLCommandsIdempotent(const ObjectAddress *address);
extern List *CreateTextSearchDictDDLCommandsIdempotent(const ObjectAddress *address); extern List *CreateTextSearchDictDDLCommandsIdempotent(const ObjectAddress *address);
extern List *CreateTextSearchConfigurationObjectAddress(Node *node, extern List *CreateTextSearchConfigurationObjectAddress(Node *node,
bool missing_ok, bool bool missing_ok, bool isPostprocess);
isPostprocess);
extern List *CreateTextSearchDictObjectAddress(Node *node, extern List *CreateTextSearchDictObjectAddress(Node *node,
bool missing_ok, bool isPostprocess); bool missing_ok, bool isPostprocess);
extern List *RenameTextSearchConfigurationStmtObjectAddress(Node *node, extern List *RenameTextSearchConfigurationStmtObjectAddress(Node *node,
bool missing_ok, bool bool missing_ok, bool isPostprocess);
isPostprocess);
extern List *RenameTextSearchDictionaryStmtObjectAddress(Node *node, extern List *RenameTextSearchDictionaryStmtObjectAddress(Node *node,
bool missing_ok, bool bool missing_ok, bool isPostprocess);
isPostprocess);
extern List *AlterTextSearchConfigurationStmtObjectAddress(Node *node, extern List *AlterTextSearchConfigurationStmtObjectAddress(Node *node,
bool missing_ok, bool bool missing_ok, bool isPostprocess);
isPostprocess);
extern List *AlterTextSearchDictionaryStmtObjectAddress(Node *node, extern List *AlterTextSearchDictionaryStmtObjectAddress(Node *node,
bool missing_ok, bool bool missing_ok, bool isPostprocess);
isPostprocess);
extern List *AlterTextSearchConfigurationSchemaStmtObjectAddress(Node *node, extern List *AlterTextSearchConfigurationSchemaStmtObjectAddress(Node *node,
bool missing_ok, bool bool missing_ok, bool isPostprocess);
isPostprocess);
extern List *AlterTextSearchDictionarySchemaStmtObjectAddress(Node *node, extern List *AlterTextSearchDictionarySchemaStmtObjectAddress(Node *node,
bool missing_ok, bool bool missing_ok, bool isPostprocess);
isPostprocess);
extern List *TextSearchConfigurationCommentObjectAddress(Node *node, extern List *TextSearchConfigurationCommentObjectAddress(Node *node,
bool missing_ok, bool bool missing_ok, bool isPostprocess);
isPostprocess);
extern List *TextSearchDictCommentObjectAddress(Node *node, extern List *TextSearchDictCommentObjectAddress(Node *node,
bool missing_ok, bool isPostprocess); bool missing_ok, bool isPostprocess);
extern List *AlterTextSearchConfigurationOwnerObjectAddress(Node *node, extern List *AlterTextSearchConfigurationOwnerObjectAddress(Node *node,
bool missing_ok, bool bool missing_ok, bool isPostprocess);
isPostprocess);
extern List *AlterTextSearchDictOwnerObjectAddress(Node *node, extern List *AlterTextSearchDictOwnerObjectAddress(Node *node,
bool missing_ok, bool isPostprocess); bool missing_ok, bool isPostprocess);
extern char *GenerateBackupNameForTextSearchConfiguration(const ObjectAddress *address); extern char *GenerateBackupNameForTextSearchConfiguration(const ObjectAddress *address);
@ -691,20 +638,16 @@ extern List * PreprocessRenameTypeAttributeStmt(Node *stmt, const char *queryStr
ProcessUtilityContext ProcessUtilityContext
processUtilityContext); processUtilityContext);
extern Node *CreateTypeStmtByObjectAddress(const ObjectAddress *address); extern Node *CreateTypeStmtByObjectAddress(const ObjectAddress *address);
extern List * CompositeTypeStmtObjectAddress(Node *stmt, bool missing_ok, bool extern List *CompositeTypeStmtObjectAddress(Node *stmt, bool missing_ok, bool isPostprocess);
isPostprocess); extern List *CreateEnumStmtObjectAddress(Node *stmt, bool missing_ok, bool isPostprocess);
extern List * CreateEnumStmtObjectAddress(Node *stmt, bool missing_ok, bool
isPostprocess);
extern List *AlterTypeStmtObjectAddress(Node *stmt, bool missing_ok, bool isPostprocess); extern List *AlterTypeStmtObjectAddress(Node *stmt, bool missing_ok, bool isPostprocess);
extern List *AlterEnumStmtObjectAddress(Node *stmt, bool missing_ok, bool isPostprocess); extern List *AlterEnumStmtObjectAddress(Node *stmt, bool missing_ok, bool isPostprocess);
extern List * RenameTypeStmtObjectAddress(Node *stmt, bool missing_ok, bool extern List *RenameTypeStmtObjectAddress(Node *stmt, bool missing_ok, bool isPostprocess);
isPostprocess);
extern List *AlterTypeSchemaStmtObjectAddress(Node *stmt, extern List *AlterTypeSchemaStmtObjectAddress(Node *stmt,
bool missing_ok, bool isPostprocess); bool missing_ok, bool isPostprocess);
extern List *RenameTypeAttributeStmtObjectAddress(Node *stmt, extern List *RenameTypeAttributeStmtObjectAddress(Node *stmt,
bool missing_ok); bool missing_ok);
extern List * AlterTypeOwnerObjectAddress(Node *stmt, bool missing_ok, bool extern List *AlterTypeOwnerObjectAddress(Node *stmt, bool missing_ok, bool isPostprocess);
isPostprocess);
extern List *CreateTypeDDLCommandsIdempotent(const ObjectAddress *typeAddress); extern List *CreateTypeDDLCommandsIdempotent(const ObjectAddress *typeAddress);
extern char *GenerateBackupNameForTypeCollision(const ObjectAddress *address); extern char *GenerateBackupNameForTypeCollision(const ObjectAddress *address);
@ -742,13 +685,11 @@ extern List * PreprocessAlterViewStmt(Node *node, const char *queryString,
extern List *PostprocessAlterViewStmt(Node *node, const char *queryString); extern List *PostprocessAlterViewStmt(Node *node, const char *queryString);
extern List *PreprocessRenameViewStmt(Node *node, const char *queryString, extern List *PreprocessRenameViewStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext); ProcessUtilityContext processUtilityContext);
extern List * RenameViewStmtObjectAddress(Node *node, bool missing_ok, bool extern List *RenameViewStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
isPostprocess);
extern List *PreprocessAlterViewSchemaStmt(Node *node, const char *queryString, extern List *PreprocessAlterViewSchemaStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext); ProcessUtilityContext processUtilityContext);
extern List *PostprocessAlterViewSchemaStmt(Node *node, const char *queryString); extern List *PostprocessAlterViewSchemaStmt(Node *node, const char *queryString);
extern List * AlterViewSchemaStmtObjectAddress(Node *node, bool missing_ok, bool extern List *AlterViewSchemaStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess);
isPostprocess);
extern bool IsViewRenameStmt(RenameStmt *renameStmt); extern bool IsViewRenameStmt(RenameStmt *renameStmt);
/* trigger.c - forward declarations */ /* trigger.c - forward declarations */
@ -756,8 +697,7 @@ extern List * GetExplicitTriggerCommandList(Oid relationId);
extern HeapTuple GetTriggerTupleById(Oid triggerId, bool missingOk); extern HeapTuple GetTriggerTupleById(Oid triggerId, bool missingOk);
extern List *GetExplicitTriggerIdList(Oid relationId); extern List *GetExplicitTriggerIdList(Oid relationId);
extern List *PostprocessCreateTriggerStmt(Node *node, const char *queryString); extern List *PostprocessCreateTriggerStmt(Node *node, const char *queryString);
extern List * CreateTriggerStmtObjectAddress(Node *node, bool missingOk, bool extern List *CreateTriggerStmtObjectAddress(Node *node, bool missingOk, bool isPostprocess);
isPostprocess);
extern void CreateTriggerEventExtendNames(CreateTrigStmt *createTriggerStmt, extern void CreateTriggerEventExtendNames(CreateTrigStmt *createTriggerStmt,
char *schemaName, uint64 shardId); char *schemaName, uint64 shardId);
extern List *PreprocessAlterTriggerRenameStmt(Node *node, const char *queryString, extern List *PreprocessAlterTriggerRenameStmt(Node *node, const char *queryString,

View File

@ -227,6 +227,9 @@ extern char * DeparseGrantOnDatabaseStmt(Node *node);
extern char * DeparseAlterDatabaseStmt(Node *node); extern char * DeparseAlterDatabaseStmt(Node *node);
extern char * DeparseAlterDatabaseRefreshCollStmt(Node *node); extern char * DeparseAlterDatabaseRefreshCollStmt(Node *node);
extern char * DeparseAlterDatabaseSetStmt(Node *node); extern char * DeparseAlterDatabaseSetStmt(Node *node);
extern char * DeparseCreateDatabaseStmt(Node *node);
extern char * DeparseDropDatabaseStmt(Node *node);
/* forward declaration for deparse_publication_stmts.c */ /* forward declaration for deparse_publication_stmts.c */

View File

@ -21,6 +21,7 @@
extern bool ObjectExists(const ObjectAddress *address); extern bool ObjectExists(const ObjectAddress *address);
extern bool CitusExtensionObject(const ObjectAddress *objectAddress); extern bool CitusExtensionObject(const ObjectAddress *objectAddress);
extern bool IsAnyObjectDistributed(const List *addresses); extern bool IsAnyObjectDistributed(const List *addresses);
extern bool IsObjectDistributed(const ObjectAddress *address);
extern bool ClusterHasDistributedFunctionWithDistArgument(void); extern bool ClusterHasDistributedFunctionWithDistArgument(void);
extern void MarkObjectDistributed(const ObjectAddress *distAddress); extern void MarkObjectDistributed(const ObjectAddress *distAddress);
extern void MarkObjectDistributedViaSuperUser(const ObjectAddress *distAddress); extern void MarkObjectDistributedViaSuperUser(const ObjectAddress *distAddress);