This is an automated email from the ASF dual-hosted git repository.
chenjinbao1989 pushed a commit to branch cbdb-postgres-merge
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
The following commit(s) were added to refs/heads/cbdb-postgres-merge by this
push:
new d45ced97967 Fix compile errors for commands
d45ced97967 is described below
commit d45ced9796761de221f3eb27f94417cca850a46e
Author: Jinbao Chen <[email protected]>
AuthorDate: Fri Oct 3 22:26:29 2025 +0800
Fix compile errors for commands
---
src/backend/commands/queue.c | 6 +--
src/backend/commands/tablecmds.c | 100 ++++++++++++++++++------------------
src/backend/commands/tablecmds_gp.c | 7 ++-
src/backend/commands/tablespace.c | 9 ++--
src/backend/commands/taskcmds.c | 3 +-
src/backend/commands/trigger.c | 24 ++++++---
src/backend/commands/user.c | 37 +++++--------
src/backend/commands/vacuum.c | 25 ++++-----
src/backend/commands/vacuum_ao.c | 6 +++
src/include/commands/tablecmds.h | 2 +-
src/include/nodes/parsenodes.h | 5 ++
11 files changed, 119 insertions(+), 105 deletions(-)
diff --git a/src/backend/commands/queue.c b/src/backend/commands/queue.c
index 35b8213464d..fd8a9162caa 100644
--- a/src/backend/commands/queue.c
+++ b/src/backend/commands/queue.c
@@ -305,8 +305,8 @@ AlterResqueueCapabilityEntry(Oid queueid,
Oid resTypeOid = InvalidOid;
int resTypeInt = 0;
List *pentry = NIL;
- Value *pKeyVal = NULL;
- Value *pStrVal = NULL;
+ String *pKeyVal = NULL;
+ String *pStrVal = NULL;
if (!bWithout && (strcmp(defel->defname, "withoutliststart") ==
0))
{
@@ -462,7 +462,7 @@ AlterResqueueCapabilityEntry(Oid queueid,
while (HeapTupleIsValid(tuple = systable_getnext(sscan)))
{
List *pentry;
- Value *pResnameVal;
+ String *pResnameVal;
char *default_str;
Datum default_datum;
bool isnull = false;
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0634a91b73b..dbb17090e1d 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -272,10 +272,9 @@ struct DropRelationCallbackState
#define ATT_COMPOSITE_TYPE 0x0010
#define ATT_FOREIGN_TABLE 0x0020
#define ATT_PARTITIONED_INDEX 0x0040
-#define ATT_SEQUENCE 0x0080
+#define ATT_DIRECTORY_TABLE 0x0080
-#define ATT_DIRECTORY_TABLE 0x0100
-#define ATT_SEQUENCE 0x0200
+#define ATT_SEQUENCE 0x0100
/*
* ForeignTruncateInfo
*
@@ -592,10 +591,7 @@ static void ATExecExpandTableCTAS(AlterTableCmd *rootCmd,
Relation rel, AlterTab
static void ATExecSetDistributedBy(Relation rel, Node *node,
AlterTableCmd *cmd);
-static PartitionSpec *transformPartitionSpec(Relation rel, PartitionSpec
*partspec, char *strategy);
-static void ComputePartitionAttrs(ParseState *pstate, Relation rel, List
*partParams, AttrNumber *partattrs,
- List
**partexprs, Oid *partopclass, Oid *partcollation,
-
PartitionStrategy strategy);
+static PartitionSpec *transformPartitionSpec(Relation rel, PartitionSpec
*partspec);
static void CreateInheritance(Relation child_rel, Relation parent_rel);
static void RemoveInheritance(Relation child_rel, Relation parent_rel,
bool expect_detached);
@@ -2073,7 +2069,7 @@ relid_set_new_relfilenode(Oid relid)
Relation rel;
rel = relation_open(relid, AccessExclusiveLock);
- RelationSetNewRelfilenode(rel, rel->rd_rel->relpersistence);
+ RelationSetNewRelfilenumber(rel, rel->rd_rel->relpersistence);
heap_close(rel, NoLock);
}
}
@@ -2423,7 +2419,7 @@ ExecuteTruncateGuts(List *explicit_rels,
List *relids_logged,
DropBehavior behavior,
bool restart_seqs,
- bool run_as_table_owner
+ bool run_as_table_owner,
TruncateStmt *stmt)
{
List *rels;
@@ -5499,7 +5495,6 @@ ATController(AlterTableStmt *parsetree,
* them here.
*/
AlteredTableInfo *tab = (AlteredTableInfo *) lfirst(lc);
- Relation rel;
rel = relation_open(tab->relid, lockmode);
tab->oldDesc =
CreateTupleDescCopyConstr(RelationGetDescr(rel));
@@ -5725,7 +5720,7 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
/* Parent/Base CHECK constraints apply to child/part
tables here.
* No need for ATPartitionCheck
*/
- ATSimplePermissions(rel, ATT_TABLE | ATT_FOREIGN_TABLE);
+ ATSimplePermissions(cmd->subtype, rel, ATT_TABLE |
ATT_FOREIGN_TABLE);
pass = AT_PASS_ADD_CONSTR;
break;
case AT_AddIndexConstraint: /* ADD CONSTRAINT USING INDEX */
@@ -5776,7 +5771,7 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
break;
case AT_SetLogged: /* SET LOGGED */
ATSimplePermissions(cmd->subtype, rel, ATT_TABLE |
ATT_SEQUENCE);
- if (tab->chgPersistence, && Gp_role != GP_ROLE_EXECUTE)
+ if (tab->chgPersistence && Gp_role != GP_ROLE_EXECUTE)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot change
persistence setting twice")));
@@ -5852,7 +5847,7 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
pass = AT_PASS_MISC;
break;
}
- ATSimplePermissions(rel, ATT_TABLE |
ATT_DIRECTORY_TABLE | ATT_FOREIGN_TABLE);
+ ATSimplePermissions(cmd->subtype, rel, ATT_TABLE |
ATT_DIRECTORY_TABLE | ATT_FOREIGN_TABLE);
if (!recursing) /* MPP-5772, MPP-5784 */
{
@@ -5922,7 +5917,7 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
pass = AT_PASS_MISC;
break;
case AT_ExpandTable:
- ATSimplePermissions(rel, ATT_TABLE | ATT_FOREIGN_TABLE
| ATT_MATVIEW);
+ ATSimplePermissions(cmd->subtype, rel, ATT_TABLE |
ATT_FOREIGN_TABLE | ATT_MATVIEW);
/* ATTACH and DETACH will process in
ATExecAttachPartition function */
if (!recursing)
@@ -5951,7 +5946,7 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
break;
case AT_ExpandPartitionTablePrepare:
- ATSimplePermissions(rel, ATT_TABLE | ATT_FOREIGN_TABLE
| ATT_MATVIEW);
+ ATSimplePermissions(cmd->subtype, rel, ATT_TABLE |
ATT_FOREIGN_TABLE | ATT_MATVIEW);
/* ATTACH and DETACH will process in
ATExecAttachPartition function */
if (!recursing)
@@ -5990,7 +5985,7 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
break;
case AT_ShrinkTable:
- ATSimplePermissions(rel, ATT_TABLE | ATT_FOREIGN_TABLE
| ATT_MATVIEW);
+ ATSimplePermissions(cmd->subtype, rel, ATT_TABLE |
ATT_FOREIGN_TABLE | ATT_MATVIEW);
/* ATTACH and DETACH will process in
ATExecAttachPartition function */
if (!recursing)
@@ -6107,13 +6102,13 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd
*cmd,
case AT_PartTruncate:
case AT_PartExchange:
case AT_PartSetTemplate:
- ATSimplePermissions(rel, ATT_TABLE);
+ ATSimplePermissions(cmd->subtype, rel, ATT_TABLE);
/* No command-specific prep needed */
pass = AT_PASS_MISC;
break;
case AT_SetTags:
case AT_UnsetTags:
- ATSimplePermissions(rel, ATT_TABLE | ATT_FOREIGN_TABLE
| ATT_INDEX | ATT_SEQUENCE | ATT_VIEW | ATT_MATVIEW);
+ ATSimplePermissions(cmd->subtype, rel, ATT_TABLE |
ATT_FOREIGN_TABLE | ATT_INDEX | ATT_SEQUENCE | ATT_VIEW | ATT_MATVIEW);
/* No command-specific prep needed */
pass = AT_PASS_MISC;
break;
@@ -7477,7 +7472,7 @@ ATAocsWriteNewColumns(AlteredTableInfo *tab)
*/
segInfos = GetAllAOCSFileSegInfo(rel, snapshot, &nseg, NULL);
- basepath = relpathbackend(rel->rd_node, rel->rd_backend, MAIN_FORKNUM);
+ basepath = relpathbackend(rel->rd_locator, rel->rd_backend,
MAIN_FORKNUM);
if (nseg > 0)
{
aocs_addcol_emptyvpe(rel, segInfos, nseg,
@@ -7553,9 +7548,9 @@ ATAocsWriteNewColumns(AlteredTableInfo *tab)
* Create new segfiles for new columns for current
* appendonly segment.
*/
- RelFileNodeBackend rnode;
+ RelFileLocatorBackend rnode;
- rnode.node = rel->rd_node;
+ rnode.locator = rel->rd_locator;
rnode.backend = rel->rd_backend;
aocs_addcol_newsegfile(idesc, segInfos[segi],
@@ -8004,6 +7999,7 @@ alter_table_type_to_string(AlterTableType cmdtype)
{
case AT_AddColumn:
case AT_AddColumnToView:
+ case AT_AddColumnRecurse:
return "ADD COLUMN";
case AT_ColumnDefault:
case AT_CookedColumnDefault:
@@ -8028,10 +8024,13 @@ alter_table_type_to_string(AlterTableType cmdtype)
return "ALTER COLUMN ... SET COMPRESSION";
case AT_DropColumn:
return "DROP COLUMN";
+ case AT_DropColumnRecurse:
+ return "DROP COLUMN RECURSE";
case AT_AddIndex:
case AT_ReAddIndex:
return NULL; /* not real grammar */
case AT_AddConstraint:
+ case AT_AddConstraintRecurse:
case AT_ReAddConstraint:
case AT_ReAddDomainConstraint:
case AT_AddIndexConstraint:
@@ -8039,8 +8038,10 @@ alter_table_type_to_string(AlterTableType cmdtype)
case AT_AlterConstraint:
return "ALTER CONSTRAINT";
case AT_ValidateConstraint:
+ case AT_ValidateConstraintRecurse:
return "VALIDATE CONSTRAINT";
case AT_DropConstraint:
+ case AT_DropConstraintRecurse:
return "DROP CONSTRAINT";
case AT_ReAddComment:
return NULL; /* not real grammar */
@@ -8126,6 +8127,26 @@ alter_table_type_to_string(AlterTableType cmdtype)
return "ALTER COLUMN ... SET";
case AT_DropIdentity:
return "ALTER COLUMN ... DROP IDENTITY";
+ case AT_SetDistributedBy:
+ return "ALTER COLUMN ... SET DISTRIBUTEBY";
+ case AT_ExpandTable:
+ case AT_ExpandPartitionTablePrepare:
+ return "ALTER COLUMN ... EXPAND TABLE";
+ case AT_ShrinkTable :
+ return "ALTER COLUMN ... SHRINK TABLE";
+ case AT_SetTags :
+ return "ALTER COLUMN ... SET TAG";
+ case AT_UnsetTags :
+ return "ALTER COLUMN ... UNSET TAG";
+ case AT_PartAdd :
+ case AT_PartAlter :
+ case AT_PartDrop :
+ case AT_PartExchange :
+ case AT_PartRename :
+ case AT_PartSetTemplate :
+ case AT_PartSplit :
+ case AT_PartTruncate :
+ return "ALTER PARTITION";
case AT_ReAddStatistics:
return NULL; /* not real grammar */
}
@@ -8230,6 +8251,7 @@ ATSimplePermissions(AlterTableType cmdtype, Relation rel,
int allowed_targets)
* Throw an error when a relation has been determined to be of the wrong
* type.
*/
+#if 0
static void
ATWrongRelkindError(Relation rel, int allowed_targets)
{
@@ -8304,6 +8326,7 @@ ATWrongRelkindError(Relation rel, int allowed_targets)
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg(msg, RelationGetRelationName(rel))));
}
+#endif
/*
* ATSimpleRecursion
@@ -9261,7 +9284,7 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab,
Relation rel,
foreach (lc, all_inheritors)
{
Oid r = lfirst_oid(lc);
- Relation rel = heap_open(r, NoLock);
+ rel = heap_open(r, NoLock);
AlteredTableInfo *childtab;
childtab = ATGetQueueEntry(wqueue, rel);
@@ -16001,7 +16024,6 @@ ATPostAlterTypeParse(Oid oldId, Oid oldRelId, Oid
refRelId, char *cmd,
if (Gp_role == GP_ROLE_EXECUTE && context != NULL)
{
ListCell *lc;
- Relation rel;
Relation irel = NULL;
AlteredTableInfo *tab;
@@ -16020,7 +16042,7 @@ ATPostAlterTypeParse(Oid oldId, Oid oldRelId, Oid
refRelId, char *cmd,
stmt = (IndexStmt *) cmd->def;
/* if we are not reusing this index, continue */
- if (!OidIsValid(stmt->oldNode))
+ if (!OidIsValid(stmt->oldNumber))
continue;
if (irel == NULL)
@@ -16046,7 +16068,7 @@ ATPostAlterTypeParse(Oid oldId, Oid oldRelId, Oid
refRelId, char *cmd,
/* If it is for the current index, replace the relnode
with my own. */
if (strcmp(stmt->idxname, irel->rd_rel->relname.data)
== 0)
- stmt->oldNode = irel->rd_node.relNode;
+ stmt->oldNumber = irel->rd_locator.relNumber;
}
if (irel != NULL)
@@ -17007,28 +17029,6 @@ ATPrepSetAccessMethod(AlteredTableInfo *tab, Relation
rel, const char *amname)
tab->newAccessMethod = amoid;
}
-/*
- * Preparation phase for SET ACCESS METHOD
- *
- * Check that access method exists. If it is the same as the table's current
- * access method, it is a no-op. Otherwise, a table rewrite is necessary.
- */
-static void
-ATPrepSetAccessMethod(AlteredTableInfo *tab, Relation rel, const char *amname)
-{
- Oid amoid;
-
- /* Check that the table access method exists */
- amoid = get_table_am_oid(amname, false);
-
- if (rel->rd_rel->relam == amoid)
- return;
-
- /* Save info for Phase 3 to do the real work */
- tab->rewrite |= AT_REWRITE_ACCESS_METHOD;
- tab->newAccessMethod = amoid;
-}
-
/*
* ALTER TABLE SET TABLESPACE
*/
@@ -18852,7 +18852,7 @@ build_ctas_with_dist(Relation rel, DistributedBy
*dist_clause,
rawstmt->stmt_location = -1;
rawstmt->stmt_len = 0;
- q_list = pg_analyze_and_rewrite(rawstmt, synthetic_sql, NULL,
0, NULL);
+ q_list = pg_analyze_and_rewrite_fixedparams(rawstmt,
synthetic_sql, NULL, 0, NULL);
p_list = pg_plan_queries(q_list, synthetic_sql, 0, NULL);
pstmt = linitial_node(PlannedStmt, p_list);
ctas = castNode(CreateTableAsStmt, pstmt->utilityStmt);
@@ -18868,7 +18868,7 @@ build_ctas_with_dist(Relation rel, DistributedBy
*dist_clause,
rawstmt->stmt_location = -1;
rawstmt->stmt_len = 0;
- q = parse_analyze(rawstmt, synthetic_sql, NULL, 0, NULL);
+ q = parse_analyze_fixedparams(rawstmt, synthetic_sql, NULL, 0,
NULL);
}
else
q = (Query *) n;
@@ -19151,7 +19151,7 @@ prebuild_temp_table(Relation rel, RangeVar *tmpname,
DistributedBy *distro,
rawstmt->stmt_location = -1;
rawstmt->stmt_len = 0;
- q = parse_analyze(rawstmt, synthetic_sql, NULL, 0, NULL);
+ q = parse_analyze_fixedparams(rawstmt, synthetic_sql, NULL, 0,
NULL);
/* No planning needed, just make a wrapper PlannedStmt */
PlannedStmt *pstmt = makeNode(PlannedStmt);
diff --git a/src/backend/commands/tablecmds_gp.c
b/src/backend/commands/tablecmds_gp.c
index 186e48ac717..9b79706571d 100644
--- a/src/backend/commands/tablecmds_gp.c
+++ b/src/backend/commands/tablecmds_gp.c
@@ -298,13 +298,13 @@ generatePartitionSpec(Relation rel)
switch (form->partstrat)
{
case PARTITION_STRATEGY_RANGE:
- subpart->strategy = psprintf("range");
+ subpart->strategy = PARTITION_STRATEGY_RANGE;
break;
case PARTITION_STRATEGY_LIST:
- subpart->strategy = psprintf("list");
+ subpart->strategy = PARTITION_STRATEGY_LIST;
break;
case PARTITION_STRATEGY_HASH:
- subpart->strategy = psprintf("hash");
+ subpart->strategy = PARTITION_STRATEGY_HASH;
break;
}
@@ -1187,7 +1187,6 @@ ATExecGPPartCmds(Relation origrel, AlterTableCmd *cmd)
PartitionSpec *subpart = NULL;
Relation temprel = rel;
PartitionSpec *tempsubpart = NULL;
- ListCell *l;
List *ancestors =
get_partition_ancestors(RelationGetRelid(rel));
int level
= list_length(ancestors) + 1;
diff --git a/src/backend/commands/tablespace.c
b/src/backend/commands/tablespace.c
index 8fe677038d9..1ad7c6a8f70 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -177,8 +177,8 @@ TablespaceCreateDbspace(Oid spcOid, Oid dbOid, bool isRedo)
Assert(OidIsValid(spcOid));
Assert(OidIsValid(dbOid));
- if (spcNode != DEFAULTTABLESPACE_OID && !isRedo)
- TablespaceLockTuple(spcNode, AccessShareLock, true);
+ if (spcOid != DEFAULTTABLESPACE_OID && !isRedo)
+ TablespaceLockTuple(spcOid, AccessShareLock, true);
dir = GetDatabasePath(dbOid, spcOid);
@@ -273,6 +273,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
Datum newOptions;
List *nonContentOptions = NIL;
char *fileHandler = NULL;
+ bool in_place;
/* Must be superuser */
if (!superuser())
@@ -301,7 +302,8 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
if (strlen(defel->defname) > strlen("content") &&
strncmp(defel->defname, "content",
strlen("content")) == 0)
{
- int contentId = pg_atoi(defel->defname +
strlen("content"), sizeof(int16), 0);
+ char *endp;
+ int contentId = strtol(defel->defname +
strlen("content"), &endp, 10);
/*
* The master validates the content ids are in
[0, segCount)
@@ -845,6 +847,7 @@ create_tablespace_directories(const char *location, const
Oid tablespaceoid)
location_with_dbid_dir = psprintf("%s/%d", location, GpIdentity.dbid);
location_with_version_dir = psprintf("%s/%s", location_with_dbid_dir,
GP_TABLESPACE_VERSION_DIRECTORY);
+ in_place = strlen(location) == 0;
/*
* Attempt to coerce target directory to safe permissions. If this
fails,
diff --git a/src/backend/commands/taskcmds.c b/src/backend/commands/taskcmds.c
index 1c2b775da97..d6e17c9476f 100644
--- a/src/backend/commands/taskcmds.c
+++ b/src/backend/commands/taskcmds.c
@@ -30,6 +30,7 @@
#include "catalog/dependency.h"
#include "catalog/namespace.h"
+#include "catalog/pg_database.h"
#include "catalog/pg_task.h"
#include "catalog/pg_task_run_history.h"
#include "cdb/cdbvars.h"
@@ -57,7 +58,7 @@ DefineTask(ParseState *pstate, CreateTaskStmt * stmt)
AclResult aclresult;
/* must have CREATE privilege on database */
- aclresult = pg_database_aclcheck(MyDatabaseId, GetUserId(), ACL_CREATE);
+ aclresult = object_aclcheck(DatabaseRelationId, MyDatabaseId,
GetUserId(), ACL_CREATE);
if (aclresult != ACLCHECK_OK)
aclcheck_error(aclresult, OBJECT_DATABASE,
get_database_name(MyDatabaseId));
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index 09732b2b6d9..9d2b204fef4 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -4946,17 +4946,29 @@ SetTransitionTableName(Oid relid, CmdType cmdType, Oid
mvoid)
table = (AfterTriggersTableData *) lfirst(lc);
if (table->relid == relid && table->cmdType == cmdType)
{
- if (table->new_tuplestore)
+ if (table->new_ins_tuplestore)
{
char *name = MakeDeltaName("new", relid,
gp_command_count);
-
tuplestore_set_sharedname(table->new_tuplestore, name);
- tuplestore_set_tableid(table->new_tuplestore,
relid);
+
tuplestore_set_sharedname(table->new_ins_tuplestore, name);
+
tuplestore_set_tableid(table->new_ins_tuplestore, relid);
}
- if (table->old_tuplestore)
+ if (table->new_upd_tuplestore)
+ {
+ char *name = MakeDeltaName("new", relid,
gp_command_count);
+
tuplestore_set_sharedname(table->new_upd_tuplestore, name);
+
tuplestore_set_tableid(table->new_upd_tuplestore, relid);
+ }
+ if (table->old_del_tuplestore)
+ {
+ char *name = MakeDeltaName("old", relid,
gp_command_count);
+
tuplestore_set_sharedname(table->old_del_tuplestore, name);
+
tuplestore_set_tableid(table->old_del_tuplestore, relid);
+ }
+ if (table->old_upd_tuplestore)
{
char *name = MakeDeltaName("old", relid,
gp_command_count);
-
tuplestore_set_sharedname(table->old_tuplestore, name);
- tuplestore_set_tableid(table->old_tuplestore,
relid);
+
tuplestore_set_sharedname(table->old_upd_tuplestore, name);
+
tuplestore_set_tableid(table->old_upd_tuplestore, relid);
}
found = true;
}
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index cd251b4a724..6a95cc0e0b7 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -792,7 +792,6 @@ CreateRole(ParseState *pstate, CreateRoleStmt *stmt)
/* Scan the pg_profile relation to be certain the profile
exists. */
Relation pg_profile_rel;
TupleDesc pg_profile_dsc;
- HeapTuple tuple;
Form_pg_profile profileform;
Oid profileid;
@@ -1458,12 +1457,12 @@ AlterRole(ParseState *pstate, AlterRoleStmt *stmt)
* change the default resource group accordingly:
admin_group
* for superuser and default_group for non-superuser
*/
- if (issuper == 0 && roleResgroup == ADMINRESGROUP_OID)
+ if (should_be_super == 0 && roleResgroup ==
ADMINRESGROUP_OID)
{
new_record[Anum_pg_authid_rolresgroup - 1] =
ObjectIdGetDatum(DEFAULTRESGROUP_OID);
new_record_repl[Anum_pg_authid_rolresgroup - 1]
= true;
}
- else if (issuper > 0 && roleResgroup ==
DEFAULTRESGROUP_OID)
+ else if (should_be_super > 0 && roleResgroup ==
DEFAULTRESGROUP_OID)
{
new_record[Anum_pg_authid_rolresgroup - 1] =
ObjectIdGetDatum(ADMINRESGROUP_OID);
new_record_repl[Anum_pg_authid_rolresgroup - 1]
= true;
@@ -1471,7 +1470,7 @@ AlterRole(ParseState *pstate, AlterRoleStmt *stmt)
}
/* get current superuser status */
- bWas_super = (issuper > 0);
+ bWas_super = should_be_super;
}
if (dinherit)
@@ -1588,7 +1587,7 @@ AlterRole(ParseState *pstate, AlterRoleStmt *stmt)
int32 profile_reuse_max = 0;
SysScanDesc password_history_scan;
HeapTuple profiletuple;
- char *logdetail;
+ const char *logdetail;
bool ignore_password_history = false;
pg_profile_rel = table_open(ProfileRelationId, AccessShareLock);
@@ -1744,7 +1743,7 @@ AlterRole(ParseState *pstate, AlterRoleStmt *stmt)
profileform = (Form_pg_profile) GETSTRUCT(profile_tuple);
profileid = profileform->oid;
- new_record[Anum_pg_authid_rolprofile - 1] =
PointerGetDatum(profileid);
+ new_record[Anum_pg_authid_rolprofile - 1] = profileid;
new_record_repl[Anum_pg_authid_rolprofile - 1] = true;
ReleaseSysCache(profile_tuple);
@@ -1919,23 +1918,14 @@ AlterRole(ParseState *pstate, AlterRoleStmt *stmt)
CommandCounterIncrement();
- if (stmt->action == +1) /* add members to role */
- {
- if (rolemembers)
- alter_subtype = "ADD USER";
-
- AddRoleMems(currentUserId, rolename, roleid,
- rolemembers,
roleSpecsToIds(rolemembers),
- InvalidOid, &popt);
- }
- else if (stmt->action == -1) /* drop members from role */
- {
- if (rolemembers)
- alter_subtype = "DROP USER";
-
- DelRoleMems(currentUserId, rolename, roleid,
- rolemembers,
roleSpecsToIds(rolemembers),
- InvalidOid, &popt, DROP_RESTRICT);
+ if (stmt->action == +1) /* add members to role */
+ AddRoleMems(currentUserId, rolename, roleid,
+ rolemembers,
roleSpecsToIds(rolemembers),
+ InvalidOid, &popt);
+ else if (stmt->action == -1) /* drop members from role */
+ DelRoleMems(currentUserId, rolename, roleid,
+ rolemembers,
roleSpecsToIds(rolemembers),
+ InvalidOid, &popt,
DROP_RESTRICT);
}
if (bWas_super)
@@ -2301,6 +2291,7 @@ DropRole(DropRoleStmt *stmt)
if (Gp_role == GP_ROLE_DISPATCH)
MetaTrackDropObject(AuthIdRelationId,
roleid);
+ /*
* Advance command counter so that later iterations of this
loop will
* see the changes already made. This is essential if, for
example,
* we are trying to drop both a role and one of its direct
members ---
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 1bffb7463a2..f8b081f279d 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -258,7 +258,7 @@ ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool
isTopLevel, bool auto_s
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("BUFFER_USAGE_LIMIT
option must be 0 or between %d kB and %d kB",
MIN_BAS_VAC_RING_SIZE_KB, MAX_BAS_VAC_RING_SIZE_KB),
- hintmsg ? errhint("%s",
_(hintmsg)) : 0));
+ hintmsg ? errhint("%s",
(hintmsg)) : 0));
}
ring_size = result;
@@ -369,7 +369,7 @@ ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool
isTopLevel, bool auto_s
(process_main ? VACOPT_PROCESS_MAIN : 0) |
(process_toast ? VACOPT_PROCESS_TOAST : 0) |
(skip_database_stats ? VACOPT_SKIP_DATABASE_STATS : 0) |
- (only_database_stats ? VACOPT_ONLY_DATABASE_STATS : 0);
+ (only_database_stats ? VACOPT_ONLY_DATABASE_STATS : 0) |
(update_datfrozenxid ? VACOPT_UPDATE_DATFROZENXID : 0);
if (rootonly)
@@ -2849,11 +2849,9 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams
*params,
* we're processing. Build a rangevar representing this partition, so
that we
* can dispatch it.
*/
- MemoryContext oldcontext = MemoryContextSwitchTo(vac_context);
this_rangevar =
makeRangeVar(get_namespace_name(rel->rd_rel->relnamespace),
pstrdup(RelationGetRelationName(rel)),
-1);
- MemoryContextSwitchTo(oldcontext);
/*
* Switch to the table owner's userid, so that any index functions are
run
@@ -2961,18 +2959,18 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams
*params,
* transactions.
*/
params->options = orig_options | VACOPT_AO_PRE_CLEANUP_PHASE;
- vacuum_rel(relid, this_rangevar, params, false);
+ vacuum_rel(relid, this_rangevar, params, bstrategy, false);
/* Compact. This runs in a distributed transaction. */
params->options = orig_options | VACOPT_AO_COMPACT_PHASE;
- vacuum_rel(relid, this_rangevar, params, false);
+ vacuum_rel(relid, this_rangevar, params, bstrategy, false);
/*
* Do a final round of cleanup. Hopefully, this can drop the
segments
* that were compacted in the previous phase.
*/
params->options = orig_options | VACOPT_AO_POST_CLEANUP_PHASE;
- vacuum_rel(relid, this_rangevar, params, false);
+ vacuum_rel(relid, this_rangevar, params, bstrategy, false);
params->options = orig_options;
}
@@ -3010,20 +3008,20 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams
*params,
memcpy(&toast_vacuum_params, params, sizeof(VacuumParams));
toast_vacuum_params.options |= VACOPT_PROCESS_MAIN;
- vacuum_rel(toast_relid, NULL, &toast_vacuum_params, bstrategy);
+ vacuum_rel(toast_relid, NULL, &toast_vacuum_params, bstrategy,
true);
}
/* do the same for an AO segments table, if any */
if (aoseg_relid != InvalidOid)
- vacuum_rel(aoseg_relid, NULL , params, true);
+ vacuum_rel(aoseg_relid, NULL , params, bstrategy, true);
/* do the same for an AO block directory table, if any */
if (aoblkdir_relid != InvalidOid)
- vacuum_rel(aoblkdir_relid, NULL, params, true);
+ vacuum_rel(aoblkdir_relid, NULL, params, bstrategy, true);
/* do the same for an AO visimap, if any */
if (aovisimap_relid != InvalidOid)
- vacuum_rel(aovisimap_relid, NULL, params, true);
+ vacuum_rel(aovisimap_relid, NULL, params, bstrategy, true);
params->options = orig_option;
/*
@@ -3489,7 +3487,6 @@ static void
vacuum_combine_stats(VacuumStatsContext *stats_context, CdbPgResults
*cdb_pgresults)
{
int result_no;
- MemoryContext old_context;
Assert(Gp_role == GP_ROLE_DISPATCH);
@@ -3547,14 +3544,12 @@ vacuum_combine_stats(VacuumStatsContext *stats_context,
CdbPgResults *cdb_pgresu
{
Assert(pgresult->extraslen == sizeof(VPgClassStats));
- old_context = MemoryContextSwitchTo(vac_context);
pgclass_stats_combo =
palloc(sizeof(VPgClassStatsCombo));
memcpy(pgclass_stats_combo, pgresult->extras,
pgresult->extraslen);
pgclass_stats_combo->count = 1;
stats_context->updated_stats =
lappend(stats_context->updated_stats,
pgclass_stats_combo);
- MemoryContextSwitchTo(old_context);
}
}
}
@@ -3643,6 +3638,8 @@ vac_update_relstats_from_list(VacuumStatsContext
*stats_context)
rel->rd_rel->relhasindex,
InvalidTransactionId,
InvalidMultiXactId,
+ NULL,
+ NULL,
false,
false /*
isvacuum */);
}
diff --git a/src/backend/commands/vacuum_ao.c b/src/backend/commands/vacuum_ao.c
index 466fe30665d..4895cc50e33 100644
--- a/src/backend/commands/vacuum_ao.c
+++ b/src/backend/commands/vacuum_ao.c
@@ -306,6 +306,8 @@ ao_vacuum_rel_post_cleanup(Relation onerel, VacuumParams
*params, BufferAccessSt
relhasindex,
FreezeLimit,
MultiXactCutoff,
+ NULL,
+ NULL,
false,
true /* isvacuum */);
@@ -667,6 +669,8 @@ vacuum_appendonly_index(Relation indexRelation,
false,
InvalidTransactionId,
InvalidMultiXactId,
+ NULL,
+ NULL,
false,
true /* isvacuum */);
@@ -830,6 +834,8 @@ scan_index(Relation indrel, Relation aorel, int elevel,
BufferAccessStrategy vac
false,
InvalidTransactionId,
InvalidMultiXactId,
+ NULL,
+ NULL,
false,
true /* isvacuum */);
diff --git a/src/include/commands/tablecmds.h b/src/include/commands/tablecmds.h
index caf1f43a992..7f91492e236 100644
--- a/src/include/commands/tablecmds.h
+++ b/src/include/commands/tablecmds.h
@@ -126,7 +126,7 @@ extern void RangeVarCallbackOwnsRelation(const RangeVar
*relation,
extern bool PartConstraintImpliedByRelConstraint(Relation scanrel,
List *partConstraint);
extern void ComputePartitionAttrs(ParseState *pstate, Relation rel, List
*partParams, AttrNumber *partattrs,
- List
**partexprs, Oid *partopclass, Oid *partcollation, char strategy);
+ List
**partexprs, Oid *partopclass, Oid *partcollation, PartitionStrategy strategy);
/* GPDB specific functions */
extern void ATExecGPPartCmds(Relation origrel, AlterTableCmd *cmd);
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index aee13f72148..5717b79a416 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -2410,6 +2410,7 @@ typedef struct AlterTagStmt
typedef enum AlterTableType
{
AT_AddColumn, /* add column */
+ AT_AddColumnRecurse, /* internal to commands/tablecmds.c */
AT_AddColumnToView, /* implicitly via CREATE OR
REPLACE VIEW */
AT_ColumnDefault, /* alter column default */
AT_CookedColumnDefault, /* add a pre-cooked column default */
@@ -2423,15 +2424,19 @@ typedef enum AlterTableType
AT_SetStorage, /* alter column set storage */
AT_SetCompression, /* alter column set compression
*/
AT_DropColumn, /* drop column */
+ AT_DropColumnRecurse, /* internal to commands/tablecmds.c */
AT_AddIndex, /* add index */
AT_ReAddIndex, /* internal to
commands/tablecmds.c */
AT_AddConstraint, /* add constraint */
+ AT_AddConstraintRecurse, /* internal to commands/tablecmds.c */
AT_ReAddConstraint, /* internal to
commands/tablecmds.c */
AT_ReAddDomainConstraint, /* internal to commands/tablecmds.c */
AT_AlterConstraint, /* alter constraint */
AT_ValidateConstraint, /* validate constraint */
+ AT_ValidateConstraintRecurse, /* internal to commands/tablecmds.c */
AT_AddIndexConstraint, /* add constraint using existing index
*/
AT_DropConstraint, /* drop constraint */
+ AT_DropConstraintRecurse, /* internal to commands/tablecmds.c */
AT_ReAddComment, /* internal to
commands/tablecmds.c */
AT_AlterColumnType, /* alter column type */
AT_AlterColumnGenericOptions, /* alter column OPTIONS (...) */
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]