Miscellaneous cleanup in prep for collation propagation

pull/3089/head
Philip Dubé 2019-11-18 20:04:02 +00:00 committed by Philip Dubé
parent 1ed05be82c
commit b7fef5c31a
19 changed files with 239 additions and 241 deletions

View File

@ -12,6 +12,7 @@
#include "catalog/dependency.h"
#include "catalog/objectaddress.h"
#include "commands/extension.h"
#include "distributed/commands.h"
#include "distributed/connection_management.h"
#include "distributed/metadata/dependency.h"
@ -267,6 +268,55 @@ ReplicateAllDependenciesToNode(const char *nodeName, int nodePort)
}
/*
* ShouldPropagate determines if we should be propagating anything
*/
bool
ShouldPropagate(void)
{
if (creating_extension)
{
/*
* extensions should be created separately on the workers, types cascading from an
* extension should therefore not be propagated.
*/
return false;
}
if (!EnableDependencyCreation)
{
/*
* we are configured to disable object propagation, should not propagate anything
*/
return false;
}
return true;
}
/*
* ShouldPropagateObject determines if we should be propagating DDLs based
* on their object address.
*/
bool
ShouldPropagateObject(const ObjectAddress *address)
{
if (!ShouldPropagate())
{
return false;
}
if (!IsObjectDistributed(address))
{
/* do not propagate for non-distributed types */
return false;
}
return true;
}
/*
* FilterObjectAddressListByPredicate takes a list of ObjectAddress *'s and returns a list
* only containing the ObjectAddress *'s for which the predicate returned true.

View File

@ -780,7 +780,7 @@ RecreateExtensionStmt(Oid extensionOid)
* AlterExtensionSchemaStmtObjectAddress returns the ObjectAddress of the extension that is
* the subject of the AlterObjectSchemaStmt. Errors if missing_ok is false.
*/
const ObjectAddress *
ObjectAddress *
AlterExtensionSchemaStmtObjectAddress(AlterObjectSchemaStmt *alterExtensionSchemaStmt,
bool missing_ok)
{
@ -812,7 +812,7 @@ AlterExtensionSchemaStmtObjectAddress(AlterObjectSchemaStmt *alterExtensionSchem
* AlterExtensionUpdateStmtObjectAddress returns the ObjectAddress of the extension that is
* the subject of the AlterExtensionStmt. Errors if missing_ok is false.
*/
const ObjectAddress *
ObjectAddress *
AlterExtensionUpdateStmtObjectAddress(AlterExtensionStmt *alterExtensionStmt,
bool missing_ok)
{

View File

@ -1256,7 +1256,7 @@ ProcessCreateFunctionStmt(CreateFunctionStmt *stmt, const char *queryString)
* CREATE [OR REPLACE] FUNCTION statement. If missing_ok is false it will error with the
* normal postgres error for unfound functions.
*/
const ObjectAddress *
ObjectAddress *
CreateFunctionStmtObjectAddress(CreateFunctionStmt *stmt, bool missing_ok)
{
ObjectType objectType = OBJECT_FUNCTION;
@ -1281,7 +1281,15 @@ CreateFunctionStmtObjectAddress(CreateFunctionStmt *stmt, bool missing_ok)
}
const ObjectAddress *
/*
* DefineAggregateStmtObjectAddress finds the ObjectAddress for the composite type described
* by the DefineStmtObjectAddress. If missing_ok is false this function throws an error if the
* aggregate does not exist.
*
* Never returns NULL, but the objid in the address could be invalid if missing_ok was set
* to true.
*/
ObjectAddress *
DefineAggregateStmtObjectAddress(DefineStmt *stmt, bool missing_ok)
{
ObjectWithArgs *objectWithArgs = NULL;
@ -1609,7 +1617,7 @@ PlanAlterFunctionDependsStmt(AlterObjectDependsStmt *stmt, const char *queryStri
* is the subject of an ALTER FUNCTION ... DEPENS ON EXTENSION ... statement. If
* missing_ok is set to false the lookup will raise an error.
*/
const ObjectAddress *
ObjectAddress *
AlterFunctionDependsStmtObjectAddress(AlterObjectDependsStmt *stmt, bool missing_ok)
{
AssertObjectTypeIsFunctional(stmt->objectType);
@ -1647,7 +1655,7 @@ ProcessAlterFunctionSchemaStmt(AlterObjectSchemaStmt *stmt, const char *queryStr
* AlterFunctionStmt. If missing_ok is set to false an error will be raised if postgres
* was unable to find the function/procedure that was the target of the statement.
*/
const ObjectAddress *
ObjectAddress *
AlterFunctionStmtObjectAddress(AlterFunctionStmt *stmt, bool missing_ok)
{
return FunctionToObjectAddress(stmt->objtype, stmt->func, missing_ok);
@ -1658,7 +1666,7 @@ AlterFunctionStmtObjectAddress(AlterFunctionStmt *stmt, bool missing_ok)
* RenameFunctionStmtObjectAddress returns the ObjectAddress of the function that is the
* subject of the RenameStmt. Errors if missing_ok is false.
*/
const ObjectAddress *
ObjectAddress *
RenameFunctionStmtObjectAddress(RenameStmt *stmt, bool missing_ok)
{
return FunctionToObjectAddress(stmt->renameType,
@ -1670,7 +1678,7 @@ RenameFunctionStmtObjectAddress(RenameStmt *stmt, bool missing_ok)
* AlterFunctionOwnerObjectAddress returns the ObjectAddress of the function that is the
* subject of the AlterOwnerStmt. Errors if missing_ok is false.
*/
const ObjectAddress *
ObjectAddress *
AlterFunctionOwnerObjectAddress(AlterOwnerStmt *stmt, bool missing_ok)
{
return FunctionToObjectAddress(stmt->objectType,
@ -1687,7 +1695,7 @@ AlterFunctionOwnerObjectAddress(AlterOwnerStmt *stmt, bool missing_ok)
* the new schema. Errors if missing_ok is false and the type cannot be found in either of
* the schemas.
*/
const ObjectAddress *
ObjectAddress *
AlterFunctionSchemaStmtObjectAddress(AlterObjectSchemaStmt *stmt, bool missing_ok)
{
ObjectWithArgs *objectWithArgs = NULL;

View File

@ -98,7 +98,6 @@ static CreateEnumStmt * RecreateEnumStmt(Oid typeOid);
static List * EnumValsList(Oid typeOid);
static bool ShouldPropagateTypeCreate(void);
static bool ShouldPropagateAlterType(const ObjectAddress *address);
/*
@ -210,7 +209,7 @@ PlanAlterTypeStmt(AlterTableStmt *stmt, const char *queryString)
Assert(stmt->relkind == OBJECT_TYPE);
typeAddress = GetObjectAddressFromParseTree((Node *) stmt, false);
if (!ShouldPropagateAlterType(typeAddress))
if (!ShouldPropagateObject(typeAddress))
{
return NIL;
}
@ -332,7 +331,7 @@ PlanAlterEnumStmt(AlterEnumStmt *stmt, const char *queryString)
List *commands = NIL;
typeAddress = GetObjectAddressFromParseTree((Node *) stmt, false);
if (!ShouldPropagateAlterType(typeAddress))
if (!ShouldPropagateObject(typeAddress))
{
return NIL;
}
@ -400,7 +399,7 @@ ProcessAlterEnumStmt(AlterEnumStmt *stmt, const char *queryString)
const ObjectAddress *typeAddress = NULL;
typeAddress = GetObjectAddressFromParseTree((Node *) stmt, false);
if (!ShouldPropagateAlterType(typeAddress))
if (!ShouldPropagateObject(typeAddress))
{
return;
}
@ -473,20 +472,8 @@ PlanDropTypeStmt(DropStmt *stmt, const char *queryString)
List *distributedTypeAddresses = NIL;
List *commands = NIL;
if (creating_extension)
if (!ShouldPropagate())
{
/*
* extensions should be created separately on the workers, types cascading from an
* extension should therefor not be propagated here.
*/
return NIL;
}
if (!EnableDependencyCreation)
{
/*
* we are configured to disable object propagation, should not propagate anything
*/
return NIL;
}
@ -549,7 +536,7 @@ PlanRenameTypeStmt(RenameStmt *stmt, const char *queryString)
List *commands = NIL;
typeAddress = GetObjectAddressFromParseTree((Node *) stmt, false);
if (!ShouldPropagateAlterType(typeAddress))
if (!ShouldPropagateObject(typeAddress))
{
return NIL;
}
@ -589,7 +576,7 @@ PlanRenameTypeAttributeStmt(RenameStmt *stmt, const char *queryString)
Assert(stmt->relationType == OBJECT_TYPE);
typeAddress = GetObjectAddressFromParseTree((Node *) stmt, false);
if (!ShouldPropagateAlterType(typeAddress))
if (!ShouldPropagateObject(typeAddress))
{
return NIL;
}
@ -623,7 +610,7 @@ PlanAlterTypeSchemaStmt(AlterObjectSchemaStmt *stmt, const char *queryString)
Assert(stmt->objectType == OBJECT_TYPE);
typeAddress = GetObjectAddressFromParseTree((Node *) stmt, false);
if (!ShouldPropagateAlterType(typeAddress))
if (!ShouldPropagateObject(typeAddress))
{
return NIL;
}
@ -656,7 +643,7 @@ ProcessAlterTypeSchemaStmt(AlterObjectSchemaStmt *stmt, const char *queryString)
Assert(stmt->objectType == OBJECT_TYPE);
typeAddress = GetObjectAddressFromParseTree((Node *) stmt, false);
if (!ShouldPropagateAlterType(typeAddress))
if (!ShouldPropagateObject(typeAddress))
{
return;
}
@ -667,8 +654,8 @@ ProcessAlterTypeSchemaStmt(AlterObjectSchemaStmt *stmt, const char *queryString)
/*
* PlanAlterTypeOwnerStmt is called for change of owner ship of types before the owner
* ship is changed on the local instance.
* PlanAlterTypeOwnerStmt is called for change of ownership of types before the
* ownership is changed on the local instance.
*
* If the type for which the owner is changed is distributed we execute the change on all
* the workers to keep the type in sync across the cluster.
@ -683,7 +670,7 @@ PlanAlterTypeOwnerStmt(AlterOwnerStmt *stmt, const char *queryString)
Assert(stmt->objectType == OBJECT_TYPE);
typeAddress = GetObjectAddressFromParseTree((Node *) stmt, false);
if (!ShouldPropagateAlterType(typeAddress))
if (!ShouldPropagateObject(typeAddress))
{
return NIL;
}
@ -865,13 +852,13 @@ EnumValsList(Oid typeOid)
/*
* CompositeTypeStmtObjectAddress finds the ObjectAddress for the composite type described
* by the CompositeTypeStmt. If missing_ok is false this function throws an error if the
* by the CompositeTypeStmt. If missing_ok is false this function throws an error if the
* type does not exist.
*
* Never returns NULL, but the objid in the address could be invalid if missing_ok was set
* to true.
*/
const ObjectAddress *
ObjectAddress *
CompositeTypeStmtObjectAddress(CompositeTypeStmt *stmt, bool missing_ok)
{
TypeName *typeName = NULL;
@ -895,7 +882,7 @@ CompositeTypeStmtObjectAddress(CompositeTypeStmt *stmt, bool missing_ok)
* Never returns NULL, but the objid in the address could be invalid if missing_ok was set
* to true.
*/
const ObjectAddress *
ObjectAddress *
CreateEnumStmtObjectAddress(CreateEnumStmt *stmt, bool missing_ok)
{
TypeName *typeName = NULL;
@ -919,7 +906,7 @@ CreateEnumStmtObjectAddress(CreateEnumStmt *stmt, bool missing_ok)
* Never returns NULL, but the objid in the address could be invalid if missing_ok was set
* to true.
*/
const ObjectAddress *
ObjectAddress *
AlterTypeStmtObjectAddress(AlterTableStmt *stmt, bool missing_ok)
{
TypeName *typeName = NULL;
@ -939,9 +926,9 @@ AlterTypeStmtObjectAddress(AlterTableStmt *stmt, bool missing_ok)
/*
* AlterEnumStmtObjectAddress return the ObjectAddress of the enum type that is the
* subject of the AlterEnumStmt. Errors is missing_ok is false.
* object of the AlterEnumStmt. Errors is missing_ok is false.
*/
const ObjectAddress *
ObjectAddress *
AlterEnumStmtObjectAddress(AlterEnumStmt *stmt, bool missing_ok)
{
TypeName *typeName = NULL;
@ -958,10 +945,10 @@ AlterEnumStmtObjectAddress(AlterEnumStmt *stmt, bool missing_ok)
/*
* RenameTypeStmtObjectAddress returns the ObjectAddress of the type that is the subject
* RenameTypeStmtObjectAddress returns the ObjectAddress of the type that is the object
* of the RenameStmt. Errors if missing_ok is false.
*/
const ObjectAddress *
ObjectAddress *
RenameTypeStmtObjectAddress(RenameStmt *stmt, bool missing_ok)
{
TypeName *typeName = NULL;
@ -981,14 +968,14 @@ RenameTypeStmtObjectAddress(RenameStmt *stmt, bool missing_ok)
/*
* AlterTypeSchemaStmtObjectAddress returns the ObjectAddress of the type that is the
* subject of the AlterObjectSchemaStmt. Errors if missing_ok is false.
* object of the AlterObjectSchemaStmt. Errors if missing_ok is false.
*
* This could be called both before or after it has been applied locally. It will look in
* the old schema first, if the type cannot be found in that schema it will look in the
* new schema. Errors if missing_ok is false and the type cannot be found in either of the
* schemas.
*/
const ObjectAddress *
ObjectAddress *
AlterTypeSchemaStmtObjectAddress(AlterObjectSchemaStmt *stmt, bool missing_ok)
{
ObjectAddress *address = NULL;
@ -1021,9 +1008,9 @@ AlterTypeSchemaStmtObjectAddress(AlterObjectSchemaStmt *stmt, bool missing_ok)
* we don't error here either, as the error would be not a good user facing
* error if the type didn't exist in the first place.
*/
names = list_make2(makeString(stmt->newschema), typeNameStr);
typeName = makeTypeNameFromNameList(names);
typeOid = LookupTypeNameOid(NULL, typeName, true);
List *newNames = list_make2(makeString(stmt->newschema), typeNameStr);
TypeName *newTypeName = makeTypeNameFromNameList(newNames);
typeOid = LookupTypeNameOid(NULL, newTypeName, true);
/*
* if the type is still invalid we couldn't find the type, error with the same
@ -1031,9 +1018,6 @@ AlterTypeSchemaStmtObjectAddress(AlterObjectSchemaStmt *stmt, bool missing_ok)
*/
if (!missing_ok && typeOid == InvalidOid)
{
names = (List *) stmt->object;
typeName = makeTypeNameFromNameList(names);
ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("type \"%s\" does not exist",
TypeNameToString(typeName))));
@ -1049,13 +1033,13 @@ AlterTypeSchemaStmtObjectAddress(AlterObjectSchemaStmt *stmt, bool missing_ok)
/*
* RenameTypeAttributeStmtObjectAddress returns the ObjectAddress of the type that is the
* subject of the RenameStmt. Errors if missing_ok is false.
* object of the RenameStmt. Errors if missing_ok is false.
*
* The ObjectAddress is that of the type, not that of the attributed for which the name is
* changed as Attributes are not distributed on their own but as a side effect of the
* whole type distribution.
*/
const ObjectAddress *
ObjectAddress *
RenameTypeAttributeStmtObjectAddress(RenameStmt *stmt, bool missing_ok)
{
TypeName *typeName = NULL;
@ -1075,10 +1059,10 @@ RenameTypeAttributeStmtObjectAddress(RenameStmt *stmt, bool missing_ok)
/*
* AlterTypeOwnerObjectAddress returns the ObjectAddress of the type that is the subject
* AlterTypeOwnerObjectAddress returns the ObjectAddress of the type that is the object
* of the AlterOwnerStmt. Errors if missing_ok is false.
*/
const ObjectAddress *
ObjectAddress *
AlterTypeOwnerObjectAddress(AlterOwnerStmt *stmt, bool missing_ok)
{
TypeName *typeName = NULL;
@ -1222,7 +1206,7 @@ FilterNameListForDistributedTypes(List *objects, bool missing_ok)
/*
* TypeNameListToObjectAddresses transforms a List * of TypeName *'s into a List * of
* ObjectAddress *'s. For this to succeed all Types identiefied by the TypeName *'s should
* ObjectAddress *'s. For this to succeed all Types identified by the TypeName *'s should
* exist on this postgres, an error will be thrown otherwise.
*/
static List *
@ -1287,7 +1271,7 @@ MakeTypeNameFromRangeVar(const RangeVar *relation)
* EnsureSequentialModeForTypeDDL makes sure that the current transaction is already in
* sequential mode, or can still safely be put in sequential mode, it errors if that is
* not possible. The error contains information for the user to retry the transaction with
* sequential mode set from the beginnig.
* sequential mode set from the begining.
*
* As types are node scoped objects there exists only 1 instance of the type used by
* potentially multiple shards. To make sure all shards in the transaction can interact
@ -1338,11 +1322,8 @@ EnsureSequentialModeForTypeDDL(void)
static bool
ShouldPropagateTypeCreate()
{
if (!EnableDependencyCreation)
if (!ShouldPropagate())
{
/*
* we are configured to disable object propagation, should not propagate anything
*/
return false;
}
@ -1354,15 +1335,6 @@ ShouldPropagateTypeCreate()
return false;
}
if (creating_extension)
{
/*
* extensions should be created separately on the workers, types cascading from an
* extension should therefor not be propagated here.
*/
return false;
}
/*
* by not propagating in a transaction block we allow for parallelism to be used when
* this type will be used as a column in a table that will be created and distributed
@ -1375,37 +1347,3 @@ ShouldPropagateTypeCreate()
return true;
}
/*
* ShouldPropagateAlterType determines if we should be propagating type alterations based
* on its object address.
*/
static bool
ShouldPropagateAlterType(const ObjectAddress *address)
{
if (creating_extension)
{
/*
* extensions should be created separately on the workers, types cascading from an
* extension should therefor not be propagated.
*/
return false;
}
if (!EnableDependencyCreation)
{
/*
* we are configured to disable object propagation, should not propagate anything
*/
return false;
}
if (!IsObjectDistributed(address))
{
/* do not propagate alter types for non-distributed types */
return false;
}
return true;
}

View File

@ -467,8 +467,8 @@ multi_ProcessUtility(PlannedStmt *pstmt,
}
/*
* ALTER TABLE ... RENAME statements have their node type as RenameStmt and
* not AlterTableStmt. So, we intercept RenameStmt to tackle these commands.
* ALTER ... RENAME statements have their node type as RenameStmt.
* So intercept RenameStmt to tackle these commands.
*/
if (IsA(parsetree, RenameStmt))
{

View File

@ -17,13 +17,13 @@
#include "distributed/deparser.h"
static const char * DeparseDropStmt(DropStmt *stmt);
static const char * DeparseAlterTableStmt(AlterTableStmt *stmt);
static const char * DeparseRenameStmt(RenameStmt *stmt);
static const char * DeparseRenameAttributeStmt(RenameStmt *stmt);
static const char * DeparseAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt);
static const char * DeparseAlterOwnerStmt(AlterOwnerStmt *stmt);
static const char * DeparseAlterObjectDependsStmt(AlterObjectDependsStmt *stmt);
static char * DeparseDropStmt(DropStmt *stmt);
static char * DeparseAlterTableStmt(AlterTableStmt *stmt);
static char * DeparseRenameStmt(RenameStmt *stmt);
static char * DeparseRenameAttributeStmt(RenameStmt *stmt);
static char * DeparseAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt);
static char * DeparseAlterOwnerStmt(AlterOwnerStmt *stmt);
static char * DeparseAlterObjectDependsStmt(AlterObjectDependsStmt *stmt);
/*
* DeparseTreeNode aims to be the inverse of postgres' ParseTreeNode. Currently with
@ -31,10 +31,7 @@ static const char * DeparseAlterObjectDependsStmt(AlterObjectDependsStmt *stmt);
* required.
*
* Currently supported:
* - CREATE TYPE
* - ALTER TYPE
* - DROP TYPE
*
* - CREATE TYPE, ALTER TYPE, DROP TYPE
* - ALTER FUNCTION, ALTER PROCEDURE, ALTER AGGREGATE
* - DROP FUNCTION, DROP PROCEDURE, DROP AGGREGATE
*
@ -42,7 +39,7 @@ static const char * DeparseAlterObjectDependsStmt(AlterObjectDependsStmt *stmt);
* - ALTER EXTENSION
* - DROP EXTENSION
*/
const char *
char *
DeparseTreeNode(Node *stmt)
{
switch (nodeTag(stmt))
@ -126,7 +123,7 @@ DeparseTreeNode(Node *stmt)
* Currently with limited support. Check support before using, and add support for new
* statements as required.
*/
static const char *
static char *
DeparseDropStmt(DropStmt *stmt)
{
switch (stmt->removeType)
@ -165,7 +162,7 @@ DeparseDropStmt(DropStmt *stmt)
* Currently with limited support. Check support before using, and add support for new
* statements as required.
*/
static const char *
static char *
DeparseAlterTableStmt(AlterTableStmt *stmt)
{
switch (stmt->relkind)
@ -193,7 +190,7 @@ DeparseAlterTableStmt(AlterTableStmt *stmt)
* Currently with limited support. Check support before using, and add support for new
* statements as required.
*/
static const char *
static char *
DeparseRenameStmt(RenameStmt *stmt)
{
switch (stmt->renameType)
@ -223,7 +220,7 @@ DeparseRenameStmt(RenameStmt *stmt)
}
static const char *
static char *
DeparseRenameAttributeStmt(RenameStmt *stmt)
{
Assert(stmt->renameType == OBJECT_ATTRIBUTE);
@ -252,7 +249,7 @@ DeparseRenameAttributeStmt(RenameStmt *stmt)
* Currently with limited support. Check support before using, and add support for new
* statements as required.
*/
static const char *
static char *
DeparseAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt)
{
switch (stmt->objectType)
@ -290,7 +287,7 @@ DeparseAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt)
* Currently with limited support. Check support before using, and add support for new
* statements as required.
*/
static const char *
static char *
DeparseAlterOwnerStmt(AlterOwnerStmt *stmt)
{
switch (stmt->objectType)
@ -323,7 +320,7 @@ DeparseAlterOwnerStmt(AlterOwnerStmt *stmt)
* Currently with limited support. Check support before using, and add support for new
* statements as required.
*/
static const char *
static char *
DeparseAlterObjectDependsStmt(AlterObjectDependsStmt *stmt)
{
switch (stmt->objectType)

View File

@ -67,7 +67,7 @@ GetExtensionOption(List *extensionOptions, const char *defname)
* DeparseCreateExtensionStmt builds and returns a string representing the
* CreateExtensionStmt to be sent to worker nodes.
*/
const char *
char *
DeparseCreateExtensionStmt(CreateExtensionStmt *createExtensionStmt)
{
StringInfoData sql = { 0 };
@ -139,7 +139,7 @@ AppendCreateExtensionStmt(StringInfo buf, CreateExtensionStmt *createExtensionSt
* DeparseAlterExtensionStmt builds and returns a string representing the
* AlterExtensionStmt to be sent to worker nodes.
*/
const char *
char *
DeparseAlterExtensionStmt(AlterExtensionStmt *alterExtensionStmt)
{
StringInfoData sql = { 0 };
@ -181,7 +181,7 @@ AppendAlterExtensionStmt(StringInfo buf, AlterExtensionStmt *alterExtensionStmt)
/*
* DeparseDropExtensionStmt builds and returns a string representing the DropStmt
*/
const char *
char *
DeparseDropExtensionStmt(DropStmt *dropStmt)
{
StringInfoData str = { 0 };
@ -248,7 +248,7 @@ AppendExtensionNameList(StringInfo str, List *objects)
* DeparseAlterExtensionSchemaStmt builds and returns a string representing the
* AlterObjectSchemaStmt (ALTER EXTENSION SET SCHEMA).
*/
const char *
char *
DeparseAlterExtensionSchemaStmt(AlterObjectSchemaStmt *alterExtensionSchemaStmt)
{
StringInfoData str = { 0 };

View File

@ -41,7 +41,7 @@
/* forward declaration for deparse functions */
static const char * ObjectTypeToKeyword(ObjectType objtype);
static char * ObjectTypeToKeyword(ObjectType objtype);
static void AppendAlterFunctionStmt(StringInfo buf, AlterFunctionStmt *stmt);
static void AppendDropFunctionStmt(StringInfo buf, DropStmt *stmt);
@ -68,7 +68,7 @@ static char * CopyAndConvertToUpperCase(const char *str);
/*
* DeparseAlterFunctionStmt builds and returns a string representing the AlterFunctionStmt
*/
const char *
char *
DeparseAlterFunctionStmt(AlterFunctionStmt *stmt)
{
StringInfoData str = { 0 };
@ -84,7 +84,7 @@ DeparseAlterFunctionStmt(AlterFunctionStmt *stmt)
* ObjectTypeToKeyword returns an appropriate string for the given ObjectType
* Where the string will be one of "FUNCTION", "PROCEDURE", or "AGGREGATE"
*/
static const char *
static char *
ObjectTypeToKeyword(ObjectType objtype)
{
switch (objtype)
@ -316,7 +316,7 @@ AppendDefElemSet(StringInfo buf, DefElem *def)
/*
* DeparseRenameFunctionStmt builds and returns a string representing the RenameStmt
*/
const char *
char *
DeparseRenameFunctionStmt(RenameStmt *stmt)
{
StringInfoData str = { 0 };
@ -347,7 +347,7 @@ AppendRenameFunctionStmt(StringInfo buf, RenameStmt *stmt)
/*
* DeparseAlterFunctionSchemaStmt builds and returns a string representing the AlterObjectSchemaStmt
*/
const char *
char *
DeparseAlterFunctionSchemaStmt(AlterObjectSchemaStmt *stmt)
{
StringInfoData str = { 0 };
@ -378,7 +378,7 @@ AppendAlterFunctionSchemaStmt(StringInfo buf, AlterObjectSchemaStmt *stmt)
/*
* DeparseAlterFunctionOwnerStmt builds and returns a string representing the AlterOwnerStmt
*/
const char *
char *
DeparseAlterFunctionOwnerStmt(AlterOwnerStmt *stmt)
{
StringInfoData str = { 0 };
@ -409,7 +409,7 @@ AppendAlterFunctionOwnerStmt(StringInfo buf, AlterOwnerStmt *stmt)
/*
* DeparseAlterFunctionDependsStmt builds and returns a string representing the AlterObjectDependsStmt
*/
const char *
char *
DeparseAlterFunctionDependsStmt(AlterObjectDependsStmt *stmt)
{
StringInfoData str = { 0 };
@ -440,7 +440,7 @@ AppendAlterFunctionDependsStmt(StringInfo buf, AlterObjectDependsStmt *stmt)
/*
* DeparseDropFunctionStmt builds and returns a string representing the DropStmt
*/
const char *
char *
DeparseDropFunctionStmt(DropStmt *stmt)
{
StringInfoData str = { 0 };

View File

@ -26,7 +26,7 @@ static void AppendAlterRoleStmt(StringInfo buf, AlterRoleStmt *stmt);
* DeparseAlterRoleStmt builds and returns a string representing of the
* AlterRoleStmt for application on a remote server.
*/
const char *
char *
DeparseAlterRoleStmt(AlterRoleStmt *stmt)
{
StringInfoData buf = { 0 };

View File

@ -61,7 +61,7 @@ static void AppendAlterTypeOwnerStmt(StringInfo buf, AlterOwnerStmt *stmt);
* DeparseCompositeTypeStmt builds and returns a string representing the
* CompositeTypeStmt for application on a remote server.
*/
const char *
char *
DeparseCompositeTypeStmt(CompositeTypeStmt *stmt)
{
StringInfoData sql = { 0 };
@ -73,7 +73,7 @@ DeparseCompositeTypeStmt(CompositeTypeStmt *stmt)
}
const char *
char *
DeparseCreateEnumStmt(CreateEnumStmt *stmt)
{
StringInfoData sql = { 0 };
@ -85,7 +85,7 @@ DeparseCreateEnumStmt(CreateEnumStmt *stmt)
}
const char *
char *
DeparseAlterEnumStmt(AlterEnumStmt *stmt)
{
StringInfoData sql = { 0 };
@ -97,7 +97,7 @@ DeparseAlterEnumStmt(AlterEnumStmt *stmt)
}
const char *
char *
DeparseDropTypeStmt(DropStmt *stmt)
{
StringInfoData str = { 0 };
@ -111,7 +111,7 @@ DeparseDropTypeStmt(DropStmt *stmt)
}
const char *
char *
DeparseAlterTypeStmt(AlterTableStmt *stmt)
{
StringInfoData str = { 0 };
@ -398,7 +398,7 @@ AppendColumnDef(StringInfo str, ColumnDef *columnDef)
}
const char *
char *
DeparseRenameTypeStmt(RenameStmt *stmt)
{
StringInfoData str = { 0 };
@ -422,7 +422,7 @@ AppendRenameTypeStmt(StringInfo buf, RenameStmt *stmt)
}
const char *
char *
DeparseRenameTypeAttributeStmt(RenameStmt *stmt)
{
StringInfoData str = { 0 };
@ -455,7 +455,7 @@ AppendRenameTypeAttributeStmt(StringInfo buf, RenameStmt *stmt)
}
const char *
char *
DeparseAlterTypeSchemaStmt(AlterObjectSchemaStmt *stmt)
{
StringInfoData str = { 0 };
@ -482,7 +482,7 @@ AppendAlterTypeSchemaStmt(StringInfo buf, AlterObjectSchemaStmt *stmt)
}
const char *
char *
DeparseAlterTypeOwnerStmt(AlterOwnerStmt *stmt)
{
StringInfoData str = { 0 };

View File

@ -18,28 +18,25 @@
#include "catalog/objectaddress.h"
#include "catalog/pg_extension_d.h"
static const ObjectAddress * AlterTableStmtObjectAddress(AlterTableStmt *stmt,
bool missing_ok);
static const ObjectAddress * RenameStmtObjectAddress(RenameStmt *stmt, bool missing_ok);
static const ObjectAddress * AlterObjectSchemaStmtObjectAddress(
AlterObjectSchemaStmt *stmt, bool missing_ok);
static const ObjectAddress * RenameAttributeStmtObjectAddress(RenameStmt *stmt,
bool missing_ok);
static const ObjectAddress * AlterOwnerStmtObjectAddress(AlterOwnerStmt *stmt,
bool missing_ok);
static const ObjectAddress * AlterObjectDependsStmtObjectAddress(
AlterObjectDependsStmt *stmt, bool missing_ok);
static const ObjectAddress * CreateExtensionStmtObjectAddress(CreateExtensionStmt *stmt,
bool missing_ok);
static const ObjectAddress * AlterExtensionStmtObjectAddress(
AlterExtensionStmt *alterExtensionStmt, bool
missing_ok);
static ObjectAddress * AlterTableStmtObjectAddress(AlterTableStmt *stmt, bool missing_ok);
static ObjectAddress * RenameStmtObjectAddress(RenameStmt *stmt, bool missing_ok);
static ObjectAddress * AlterObjectSchemaStmtObjectAddress(AlterObjectSchemaStmt *stmt,
bool missing_ok);
static ObjectAddress * RenameAttributeStmtObjectAddress(RenameStmt *stmt, bool
missing_ok);
static ObjectAddress * AlterOwnerStmtObjectAddress(AlterOwnerStmt *stmt, bool missing_ok);
static ObjectAddress * AlterObjectDependsStmtObjectAddress(AlterObjectDependsStmt *stmt,
bool missing_ok);
static ObjectAddress * CreateExtensionStmtObjectAddress(CreateExtensionStmt *stmt, bool
missing_ok);
static ObjectAddress * AlterExtensionStmtObjectAddress(
AlterExtensionStmt *alterExtensionStmt, bool missing_ok);
/*
* GetObjectAddressFromParseTree returns the ObjectAdderss of the main target of the parse
* GetObjectAddressFromParseTree returns the ObjectAddress of the main target of the parse
* tree.
*/
const ObjectAddress *
ObjectAddress *
GetObjectAddressFromParseTree(Node *parseTree, bool missing_ok)
{
switch (parseTree->type)
@ -141,7 +138,7 @@ GetObjectAddressFromParseTree(Node *parseTree, bool missing_ok)
}
static const ObjectAddress *
static ObjectAddress *
AlterTableStmtObjectAddress(AlterTableStmt *stmt, bool missing_ok)
{
switch (stmt->relkind)
@ -160,7 +157,7 @@ AlterTableStmtObjectAddress(AlterTableStmt *stmt, bool missing_ok)
}
static const ObjectAddress *
static ObjectAddress *
RenameStmtObjectAddress(RenameStmt *stmt, bool missing_ok)
{
switch (stmt->renameType)
@ -191,7 +188,7 @@ RenameStmtObjectAddress(RenameStmt *stmt, bool missing_ok)
}
static const ObjectAddress *
static ObjectAddress *
AlterObjectSchemaStmtObjectAddress(AlterObjectSchemaStmt *stmt, bool missing_ok)
{
switch (stmt->objectType)
@ -222,7 +219,7 @@ AlterObjectSchemaStmtObjectAddress(AlterObjectSchemaStmt *stmt, bool missing_ok)
}
static const ObjectAddress *
static ObjectAddress *
RenameAttributeStmtObjectAddress(RenameStmt *stmt, bool missing_ok)
{
Assert(stmt->renameType == OBJECT_ATTRIBUTE);
@ -243,7 +240,7 @@ RenameAttributeStmtObjectAddress(RenameStmt *stmt, bool missing_ok)
}
static const ObjectAddress *
static ObjectAddress *
AlterOwnerStmtObjectAddress(AlterOwnerStmt *stmt, bool missing_ok)
{
switch (stmt->objectType)
@ -279,7 +276,7 @@ AlterOwnerStmtObjectAddress(AlterOwnerStmt *stmt, bool missing_ok)
* If missing_ok is set to fails the object specific implementation is supposed to raise
* an error explaining the user the object is not existing.
*/
static const ObjectAddress *
static ObjectAddress *
AlterObjectDependsStmtObjectAddress(AlterObjectDependsStmt *stmt, bool missing_ok)
{
switch (stmt->objectType)
@ -307,7 +304,7 @@ AlterObjectDependsStmtObjectAddress(AlterObjectDependsStmt *stmt, bool missing_o
* Never returns NULL, but the objid in the address could be invalid if missing_ok was set
* to true.
*/
static const ObjectAddress *
static ObjectAddress *
CreateExtensionStmtObjectAddress(CreateExtensionStmt *createExtensionStmt, bool
missing_ok)
{
@ -339,7 +336,7 @@ CreateExtensionStmtObjectAddress(CreateExtensionStmt *createExtensionStmt, bool
* Never returns NULL, but the objid in the address could be invalid if missing_ok was set
* to true.
*/
static const ObjectAddress *
static ObjectAddress *
AlterExtensionStmtObjectAddress(AlterExtensionStmt *alterExtensionStmt, bool
missing_ok)
{

View File

@ -125,10 +125,12 @@ QualifyRenameStmt(RenameStmt *stmt)
return;
}
case OBJECT_AGGREGATE:
case OBJECT_FUNCTION:
case OBJECT_PROCEDURE:
{
QualifyRenameFunctionStmt(stmt);
return;
}
default:
@ -196,10 +198,12 @@ QualifyAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt)
return;
}
case OBJECT_AGGREGATE:
case OBJECT_FUNCTION:
case OBJECT_PROCEDURE:
{
QualifyAlterFunctionSchemaStmt(stmt);
return;
}
default:
@ -222,10 +226,12 @@ QualifyAlterOwnerStmt(AlterOwnerStmt *stmt)
return;
}
case OBJECT_AGGREGATE:
case OBJECT_FUNCTION:
case OBJECT_PROCEDURE:
{
QualifyAlterFunctionOwnerStmt(stmt);
return;
}
default:
@ -245,6 +251,7 @@ QualifyAlterObjectDependsStmt(AlterObjectDependsStmt *stmt)
case OBJECT_PROCEDURE:
{
QualifyAlterFunctionDependsStmt(stmt);
return;
}
default:

View File

@ -116,7 +116,7 @@ QualifyAlterFunctionDependsStmt(AlterObjectDependsStmt *stmt)
/*
* QualifyFunction transforms a function in place and makes it's name fully qualified.
* QualifyFunction transforms a function in place and makes its name fully qualified.
*/
void
QualifyFunction(ObjectWithArgs *func, ObjectType type)

View File

@ -27,6 +27,7 @@
#include "distributed/metadata/namespace.h"
#include "nodes/makefuncs.h"
#include "parser/parse_type.h"
#include "utils/syscache.h"
#include "utils/lsyscache.h"
static char * GetTypeNamespaceNameByNameList(List *names);
@ -53,17 +54,20 @@ static Oid
TypeOidGetNamespaceOid(Oid typeOid)
{
Form_pg_type typeData = NULL;
Relation catalog = heap_open(TypeRelationId, AccessShareLock);
#if PG_VERSION_NUM >= 120000
HeapTuple typeTuple = get_catalog_object_by_oid(catalog, Anum_pg_type_oid, typeOid);
#else
HeapTuple typeTuple = get_catalog_object_by_oid(catalog, typeOid);
#endif
heap_close(catalog, AccessShareLock);
HeapTuple typeTuple = SearchSysCache1(TYPEOID, typeOid);
Oid typnamespace = InvalidOid;
if (!HeapTupleIsValid(typeTuple))
{
elog(ERROR, "citus cache lookup failed");
return InvalidOid;
}
typeData = (Form_pg_type) GETSTRUCT(typeTuple);
typnamespace = typeData->typnamespace;
return typeData->typnamespace;
ReleaseSysCache(typeTuple);
return typnamespace;
}

View File

@ -1372,31 +1372,31 @@ simple_quote_literal(StringInfo buf, const char *val)
* CURRENT_USER - resolved to the user name of the current role being used
* SESSION_USER - resolved to the user name of the user that opened the session
*
* withQuoteIdendifier is used, because if the results will be used in a query the quotes are needed but if not there
* withQuoteIdentifier is used, because if the results will be used in a query the quotes are needed but if not there
* should not be extra quotes.
*/
const char *
RoleSpecString(RoleSpec *spec, bool withQuoteIdendifier)
RoleSpecString(RoleSpec *spec, bool withQuoteIdentifier)
{
switch (spec->roletype)
{
case ROLESPEC_CSTRING:
{
return withQuoteIdendifier ?
return withQuoteIdentifier ?
quote_identifier(spec->rolename) :
spec->rolename;
}
case ROLESPEC_CURRENT_USER:
{
return withQuoteIdendifier ?
return withQuoteIdentifier ?
quote_identifier(GetUserNameFromId(GetUserId(), false)) :
GetUserNameFromId(GetUserId(), false);
}
case ROLESPEC_SESSION_USER:
{
return withQuoteIdendifier ?
return withQuoteIdentifier ?
quote_identifier(GetUserNameFromId(GetSessionUserId(), false)) :
GetUserNameFromId(GetSessionUserId(), false);
}

View File

@ -41,7 +41,7 @@ extern char * pg_get_indexclusterdef_string(Oid indexRelationId);
extern List * pg_get_table_grants(Oid relationId);
extern bool contain_nextval_expression_walker(Node *node, void *context);
extern char * pg_get_replica_identity_command(Oid tableRelationId);
extern const char * RoleSpecString(RoleSpec *spec, bool withQuoteIdendifier);
extern const char * RoleSpecString(RoleSpec *spec, bool withQuoteIdentifier);
/* Function declarations for version dependent PostgreSQL ruleutils functions */
extern void pg_get_query_def(Query *query, StringInfo buffer);

View File

@ -42,9 +42,9 @@ extern void ProcessAlterExtensionSchemaStmt(AlterObjectSchemaStmt *alterExtensio
extern List * PlanAlterExtensionUpdateStmt(AlterExtensionStmt *alterExtensionStmt, const
char *queryString);
extern List * CreateExtensionDDLCommand(const ObjectAddress *extensionAddress);
extern const ObjectAddress * AlterExtensionSchemaStmtObjectAddress(
AlterObjectSchemaStmt *stmt, bool missing_ok);
extern const ObjectAddress * AlterExtensionUpdateStmtObjectAddress(
extern ObjectAddress * AlterExtensionSchemaStmtObjectAddress(AlterObjectSchemaStmt *stmt,
bool missing_ok);
extern ObjectAddress * AlterExtensionUpdateStmtObjectAddress(
AlterExtensionStmt *alterExtensionStmt,
bool missing_ok);
@ -69,30 +69,30 @@ extern bool ConstraintIsAForeignKey(char *constraintName, Oid relationId);
extern List * PlanCreateFunctionStmt(CreateFunctionStmt *stmt, const char *queryString);
extern List * ProcessCreateFunctionStmt(CreateFunctionStmt *stmt, const
char *queryString);
extern const ObjectAddress * CreateFunctionStmtObjectAddress(CreateFunctionStmt *stmt,
bool missing_ok);
extern const ObjectAddress * DefineAggregateStmtObjectAddress(DefineStmt *stmt, bool
missing_ok);
extern ObjectAddress * CreateFunctionStmtObjectAddress(CreateFunctionStmt *stmt,
bool missing_ok);
extern ObjectAddress * DefineAggregateStmtObjectAddress(DefineStmt *stmt, bool
missing_ok);
extern List * PlanAlterFunctionStmt(AlterFunctionStmt *stmt, const char *queryString);
extern const ObjectAddress * AlterFunctionStmtObjectAddress(AlterFunctionStmt *stmt,
bool missing_ok);
extern ObjectAddress * AlterFunctionStmtObjectAddress(AlterFunctionStmt *stmt,
bool missing_ok);
extern List * PlanRenameFunctionStmt(RenameStmt *stmt, const char *queryString);
extern const ObjectAddress * RenameFunctionStmtObjectAddress(RenameStmt *stmt,
bool missing_ok);
extern ObjectAddress * RenameFunctionStmtObjectAddress(RenameStmt *stmt,
bool missing_ok);
extern List * PlanAlterFunctionOwnerStmt(AlterOwnerStmt *stmt, const char *queryString);
extern const ObjectAddress * AlterFunctionOwnerObjectAddress(AlterOwnerStmt *stmt,
bool missing_ok);
extern ObjectAddress * AlterFunctionOwnerObjectAddress(AlterOwnerStmt *stmt,
bool missing_ok);
extern List * PlanAlterFunctionSchemaStmt(AlterObjectSchemaStmt *stmt,
const char *queryString);
extern const ObjectAddress * AlterFunctionSchemaStmtObjectAddress(
AlterObjectSchemaStmt *stmt, bool missing_ok);
extern ObjectAddress * AlterFunctionSchemaStmtObjectAddress(AlterObjectSchemaStmt *stmt,
bool missing_ok);
extern void ProcessAlterFunctionSchemaStmt(AlterObjectSchemaStmt *stmt,
const char *queryString);
extern List * PlanDropFunctionStmt(DropStmt *stmt, const char *queryString);
extern List * PlanAlterFunctionDependsStmt(AlterObjectDependsStmt *stmt,
const char *queryString);
extern const ObjectAddress * AlterFunctionDependsStmtObjectAddress(
AlterObjectDependsStmt *stmt, bool missing_ok);
extern ObjectAddress * AlterFunctionDependsStmtObjectAddress(AlterObjectDependsStmt *stmt,
bool missing_ok);
/* grant.c - forward declarations */
@ -196,22 +196,17 @@ extern List * PlanAlterTypeOwnerStmt(AlterOwnerStmt *stmt, const char *queryStri
extern void ProcessAlterTypeSchemaStmt(AlterObjectSchemaStmt *stmt,
const char *queryString);
extern Node * CreateTypeStmtByObjectAddress(const ObjectAddress *address);
extern const ObjectAddress * CompositeTypeStmtObjectAddress(CompositeTypeStmt *stmt,
bool missing_ok);
extern const ObjectAddress * CreateEnumStmtObjectAddress(CreateEnumStmt *stmt,
bool missing_ok);
extern const ObjectAddress * AlterTypeStmtObjectAddress(AlterTableStmt *stmt,
extern ObjectAddress * CompositeTypeStmtObjectAddress(CompositeTypeStmt *stmt, bool
missing_ok);
extern ObjectAddress * CreateEnumStmtObjectAddress(CreateEnumStmt *stmt, bool missing_ok);
extern ObjectAddress * AlterTypeStmtObjectAddress(AlterTableStmt *stmt, bool missing_ok);
extern ObjectAddress * AlterEnumStmtObjectAddress(AlterEnumStmt *stmt, bool missing_ok);
extern ObjectAddress * RenameTypeStmtObjectAddress(RenameStmt *stmt, bool missing_ok);
extern ObjectAddress * AlterTypeSchemaStmtObjectAddress(AlterObjectSchemaStmt *stmt,
bool missing_ok);
extern const ObjectAddress * AlterEnumStmtObjectAddress(AlterEnumStmt *stmt,
bool missing_ok);
extern const ObjectAddress * RenameTypeStmtObjectAddress(RenameStmt *stmt,
bool missing_ok);
extern const ObjectAddress * AlterTypeSchemaStmtObjectAddress(AlterObjectSchemaStmt *stmt,
bool missing_ok);
extern const ObjectAddress * RenameTypeAttributeStmtObjectAddress(RenameStmt *stmt,
bool missing_ok);
extern const ObjectAddress * AlterTypeOwnerObjectAddress(AlterOwnerStmt *stmt,
bool missing_ok);
extern ObjectAddress * RenameTypeAttributeStmtObjectAddress(RenameStmt *stmt, bool
missing_ok);
extern ObjectAddress * AlterTypeOwnerObjectAddress(AlterOwnerStmt *stmt, bool missing_ok);
extern List * CreateTypeDDLCommandsIdempotent(const ObjectAddress *typeAddress);
extern char * GenerateBackupNameForTypeCollision(const ObjectAddress *address);

View File

@ -30,18 +30,18 @@ extern char * FormatCollateExtended(Oid collid, bits16 flags);
extern void AssertObjectTypeIsFunctional(ObjectType type);
extern void QualifyTreeNode(Node *stmt);
extern const char * DeparseTreeNode(Node *stmt);
extern char * DeparseTreeNode(Node *stmt);
/* forward declarations for deparse_type_stmts.c */
extern const char * DeparseCompositeTypeStmt(CompositeTypeStmt *stmt);
extern const char * DeparseCreateEnumStmt(CreateEnumStmt *stmt);
extern const char * DeparseDropTypeStmt(DropStmt *stmt);
extern const char * DeparseAlterEnumStmt(AlterEnumStmt *stmt);
extern const char * DeparseAlterTypeStmt(AlterTableStmt *stmt);
extern const char * DeparseRenameTypeStmt(RenameStmt *stmt);
extern const char * DeparseRenameTypeAttributeStmt(RenameStmt *stmt);
extern const char * DeparseAlterTypeSchemaStmt(AlterObjectSchemaStmt *stmt);
extern const char * DeparseAlterTypeOwnerStmt(AlterOwnerStmt *stmt);
extern char * DeparseCompositeTypeStmt(CompositeTypeStmt *stmt);
extern char * DeparseCreateEnumStmt(CreateEnumStmt *stmt);
extern char * DeparseDropTypeStmt(DropStmt *stmt);
extern char * DeparseAlterEnumStmt(AlterEnumStmt *stmt);
extern char * DeparseAlterTypeStmt(AlterTableStmt *stmt);
extern char * DeparseRenameTypeStmt(RenameStmt *stmt);
extern char * DeparseRenameTypeAttributeStmt(RenameStmt *stmt);
extern char * DeparseAlterTypeSchemaStmt(AlterObjectSchemaStmt *stmt);
extern char * DeparseAlterTypeOwnerStmt(AlterOwnerStmt *stmt);
extern void QualifyRenameTypeStmt(RenameStmt *stmt);
extern void QualifyRenameTypeAttributeStmt(RenameStmt *stmt);
@ -52,17 +52,17 @@ extern void QualifyCreateEnumStmt(CreateEnumStmt *stmt);
extern void QualifyAlterTypeSchemaStmt(AlterObjectSchemaStmt *stmt);
extern void QualifyAlterTypeOwnerStmt(AlterOwnerStmt *stmt);
extern const ObjectAddress * GetObjectAddressFromParseTree(Node *parseTree, bool
missing_ok);
extern ObjectAddress * GetObjectAddressFromParseTree(Node *parseTree, bool
missing_ok);
/* forward declarations for deparse_function_stmts.c */
extern const char * DeparseDropFunctionStmt(DropStmt *stmt);
extern const char * DeparseAlterFunctionStmt(AlterFunctionStmt *stmt);
extern char * DeparseDropFunctionStmt(DropStmt *stmt);
extern char * DeparseAlterFunctionStmt(AlterFunctionStmt *stmt);
extern const char * DeparseRenameFunctionStmt(RenameStmt *stmt);
extern const char * DeparseAlterFunctionSchemaStmt(AlterObjectSchemaStmt *stmt);
extern const char * DeparseAlterFunctionOwnerStmt(AlterOwnerStmt *stmt);
extern const char * DeparseAlterFunctionDependsStmt(AlterObjectDependsStmt *stmt);
extern char * DeparseRenameFunctionStmt(RenameStmt *stmt);
extern char * DeparseAlterFunctionSchemaStmt(AlterObjectSchemaStmt *stmt);
extern char * DeparseAlterFunctionOwnerStmt(AlterOwnerStmt *stmt);
extern char * DeparseAlterFunctionDependsStmt(AlterObjectDependsStmt *stmt);
extern void QualifyAlterFunctionStmt(AlterFunctionStmt *stmt);
extern void QualifyRenameFunctionStmt(RenameStmt *stmt);
@ -71,15 +71,15 @@ extern void QualifyAlterFunctionOwnerStmt(AlterOwnerStmt *stmt);
extern void QualifyAlterFunctionDependsStmt(AlterObjectDependsStmt *stmt);
/* forward declarations for deparse_role_stmts.c */
extern const char * DeparseAlterRoleStmt(AlterRoleStmt *stmt);
extern char * DeparseAlterRoleStmt(AlterRoleStmt *stmt);
/* forward declarations for deparse_extension_stmts.c */
extern Value * GetExtensionOption(List *extensionOptions, const
char *defname);
extern const char * DeparseCreateExtensionStmt(CreateExtensionStmt *stmt);
extern const char * DeparseDropExtensionStmt(DropStmt *stmt);
extern const char * DeparseAlterExtensionSchemaStmt(
extern char * DeparseCreateExtensionStmt(CreateExtensionStmt *stmt);
extern char * DeparseDropExtensionStmt(DropStmt *stmt);
extern char * DeparseAlterExtensionSchemaStmt(
AlterObjectSchemaStmt *alterExtensionSchemaStmt);
extern const char * DeparseAlterExtensionStmt(AlterExtensionStmt *alterExtensionStmt);
extern char * DeparseAlterExtensionStmt(AlterExtensionStmt *alterExtensionStmt);
#endif /* CITUS_DEPARSER_H */

View File

@ -133,6 +133,8 @@ extern void CreateDistributedTable(Oid relationId, Var *distributionColumn,
extern void CreateTruncateTrigger(Oid relationId);
extern void EnsureDependenciesExistsOnAllNodes(const ObjectAddress *target);
extern bool ShouldPropagate(void);
extern bool ShouldPropagateObject(const ObjectAddress *address);
extern void ReplicateAllDependenciesToNode(const char *nodeName, int nodePort);
/* Remaining metadata utility functions */