fixup! Adds AlterTableStmtObjType macro

talha_testpg14
Sait Talha Nisanci 2021-08-26 23:59:42 +03:00
parent 95aae43a9c
commit 32c2d138fc
11 changed files with 20 additions and 20 deletions

View File

@ -773,7 +773,7 @@ GetDistributeObjectOps(Node *node)
case T_AlterTableStmt:
{
AlterTableStmt *stmt = castNode(AlterTableStmt, node);
switch (AlterTableStmtObjType(stmt))
switch (AlterTableStmtObjType_compat(stmt))
{
case OBJECT_TYPE:
{

View File

@ -595,7 +595,7 @@ PreprocessAlterSequenceOwnerStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{
AlterTableStmt *stmt = castNode(AlterTableStmt, node);
Assert(AlterTableStmtObjType(stmt) == OBJECT_SEQUENCE);
Assert(AlterTableStmtObjType_compat(stmt) == OBJECT_SEQUENCE);
ObjectAddress sequenceAddress = GetObjectAddressFromParseTree((Node *) stmt, false);
if (!ShouldPropagateObject(&sequenceAddress))
@ -623,7 +623,7 @@ ObjectAddress
AlterSequenceOwnerStmtObjectAddress(Node *node, bool missing_ok)
{
AlterTableStmt *stmt = castNode(AlterTableStmt, node);
Assert(AlterTableStmtObjType(stmt) == OBJECT_SEQUENCE);
Assert(AlterTableStmtObjType_compat(stmt) == OBJECT_SEQUENCE);
RangeVar *sequence = stmt->relation;
Oid seqOid = RangeVarGetRelid(sequence, NoLock, missing_ok);
@ -643,7 +643,7 @@ List *
PostprocessAlterSequenceOwnerStmt(Node *node, const char *queryString)
{
AlterTableStmt *stmt = castNode(AlterTableStmt, node);
Assert(AlterTableStmtObjType(stmt) == OBJECT_SEQUENCE);
Assert(AlterTableStmtObjType_compat(stmt) == OBJECT_SEQUENCE);
ObjectAddress sequenceAddress = GetObjectAddressFromParseTree((Node *) stmt, false);
if (!ShouldPropagateObject(&sequenceAddress))

View File

@ -524,7 +524,7 @@ PreprocessAlterTableStmt(Node *node, const char *alterTableCommand,
if (get_rel_relkind(leftRelationId) == RELKIND_SEQUENCE)
{
AlterTableStmt *stmtCopy = copyObject(alterTableStatement);
AlterTableStmtObjType(stmtCopy) = OBJECT_SEQUENCE;
AlterTableStmtObjType_compat(stmtCopy) = OBJECT_SEQUENCE;
return PreprocessAlterSequenceOwnerStmt((Node *) stmtCopy, alterTableCommand,
processUtilityContext);
}
@ -1617,7 +1617,7 @@ PostprocessAlterTableStmt(AlterTableStmt *alterTableStatement)
*/
if (get_rel_relkind(relationId) == RELKIND_SEQUENCE)
{
AlterTableStmtObjType(alterTableStatement) = OBJECT_SEQUENCE;
AlterTableStmtObjType_compat(alterTableStatement) = OBJECT_SEQUENCE;
PostprocessAlterSequenceOwnerStmt((Node *) alterTableStatement, NULL);
return;
}

View File

@ -206,7 +206,7 @@ PreprocessAlterTypeStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{
AlterTableStmt *stmt = castNode(AlterTableStmt, node);
Assert(AlterTableStmtObjType(stmt) == OBJECT_TYPE);
Assert(AlterTableStmtObjType_compat(stmt) == OBJECT_TYPE);
ObjectAddress typeAddress = GetObjectAddressFromParseTree((Node *) stmt, false);
if (!ShouldPropagateObject(&typeAddress))
@ -789,7 +789,7 @@ ObjectAddress
AlterTypeStmtObjectAddress(Node *node, bool missing_ok)
{
AlterTableStmt *stmt = castNode(AlterTableStmt, node);
Assert(AlterTableStmtObjType(stmt) == OBJECT_TYPE);
Assert(AlterTableStmtObjType_compat(stmt) == OBJECT_TYPE);
TypeName *typeName = MakeTypeNameFromRangeVar(stmt->relation);
Oid typeOid = LookupTypeNameOid(NULL, typeName, missing_ok);

View File

@ -485,8 +485,8 @@ ProcessUtilityInternal(PlannedStmt *pstmt,
if (IsA(parsetree, AlterTableStmt))
{
AlterTableStmt *alterTableStmt = (AlterTableStmt *) parsetree;
if (AlterTableStmtObjType(alterTableStmt) == OBJECT_TABLE ||
AlterTableStmtObjType(alterTableStmt) == OBJECT_FOREIGN_TABLE)
if (AlterTableStmtObjType_compat(alterTableStmt) == OBJECT_TABLE ||
AlterTableStmtObjType_compat(alterTableStmt) == OBJECT_FOREIGN_TABLE)
{
ErrorIfAlterDropsPartitionColumn(alterTableStmt);

View File

@ -194,7 +194,7 @@ DeparseAlterSequenceOwnerStmt(Node *node)
StringInfoData str = { 0 };
initStringInfo(&str);
Assert(AlterTableStmtObjType(stmt) == OBJECT_SEQUENCE);
Assert(AlterTableStmtObjType_compat(stmt) == OBJECT_SEQUENCE);
AppendAlterSequenceOwnerStmt(&str, stmt);
@ -209,7 +209,7 @@ DeparseAlterSequenceOwnerStmt(Node *node)
static void
AppendAlterSequenceOwnerStmt(StringInfo buf, AlterTableStmt *stmt)
{
Assert(AlterTableStmtObjType(stmt) == OBJECT_SEQUENCE);
Assert(AlterTableStmtObjType_compat(stmt) == OBJECT_SEQUENCE);
RangeVar *seq = stmt->relation;
char *qualifiedSequenceName = quote_qualified_identifier(seq->schemaname,
seq->relname);

View File

@ -64,7 +64,7 @@ DeparseAlterTableStmt(Node *node)
StringInfoData str = { 0 };
initStringInfo(&str);
Assert(AlterTableStmtObjType(stmt) == OBJECT_TABLE);
Assert(AlterTableStmtObjType_compat(stmt) == OBJECT_TABLE);
AppendAlterTableStmt(&str, stmt);
return str.data;
@ -83,7 +83,7 @@ AppendAlterTableStmt(StringInfo buf, AlterTableStmt *stmt)
stmt->relation->relname);
ListCell *cmdCell = NULL;
Assert(AlterTableStmtObjType(stmt) == OBJECT_TABLE);
Assert(AlterTableStmtObjType_compat(stmt) == OBJECT_TABLE);
appendStringInfo(buf, "ALTER TABLE %s", identifier);
foreach(cmdCell, stmt->cmds)

View File

@ -122,7 +122,7 @@ DeparseAlterTypeStmt(Node *node)
StringInfoData str = { 0 };
initStringInfo(&str);
Assert(AlterTableStmtObjType(stmt) == OBJECT_TYPE);
Assert(AlterTableStmtObjType_compat(stmt) == OBJECT_TYPE);
AppendAlterTypeStmt(&str, stmt);
@ -137,7 +137,7 @@ AppendAlterTypeStmt(StringInfo buf, AlterTableStmt *stmt)
stmt->relation->relname);
ListCell *cmdCell = NULL;
Assert(AlterTableStmtObjType(stmt) == OBJECT_TYPE);
Assert(AlterTableStmtObjType_compat(stmt) == OBJECT_TYPE);
appendStringInfo(buf, "ALTER TYPE %s", identifier);
foreach(cmdCell, stmt->cmds)

View File

@ -32,7 +32,7 @@ void
QualifyAlterSequenceOwnerStmt(Node *node)
{
AlterTableStmt *stmt = castNode(AlterTableStmt, node);
Assert(AlterTableStmtObjType(stmt) == OBJECT_SEQUENCE);
Assert(AlterTableStmtObjType_compat(stmt) == OBJECT_SEQUENCE);
RangeVar *seq = stmt->relation;

View File

@ -126,7 +126,7 @@ void
QualifyAlterTypeStmt(Node *node)
{
AlterTableStmt *stmt = castNode(AlterTableStmt, node);
Assert(AlterTableStmtObjType(stmt) == OBJECT_TYPE);
Assert(AlterTableStmtObjType_compat(stmt) == OBJECT_TYPE);
if (stmt->relation->schemaname == NULL)
{

View File

@ -31,7 +31,7 @@
#endif
#if PG_VERSION_NUM >= PG_VERSION_14
#define AlterTableStmtObjType(a) ((a)->objtype)
#define AlterTableStmtObjType_compat(a) ((a)->objtype)
#define getObjectTypeDescription_compat(a, b) getObjectTypeDescription(a, b)
#define getObjectIdentity_compat(a, b) getObjectIdentity(a, b)
@ -57,7 +57,7 @@
#define pull_varnos_compat(a, b) pull_varnos(a, b)
#define pg_get_statisticsobj_worker_compat(a, b, c) pg_get_statisticsobj_worker(a, b, c)
#else
#define AlterTableStmtObjType(a) ((a)->relkind)
#define AlterTableStmtObjType_compat(a) ((a)->relkind)
#define F_NEXTVAL F_NEXTVAL_OID
#define ROLE_PG_MONITOR DEFAULT_ROLE_MONITOR
#define PROC_WAIT_STATUS_WAITING STATUS_WAITING