You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by ma...@apache.org on 2025/01/03 06:16:31 UTC

(cloudberry) 02/14: Minor changes to align with the upstream

This is an automated email from the ASF dual-hosted git repository.

maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit fa7f4c697f01c500d9c0ed61357adeeffe1c078b
Author: Adam Lee <ad...@vmware.com>
AuthorDate: Fri Oct 28 11:26:21 2022 +0800

    Minor changes to align with the upstream
    
    Two blocks in src/bin/psql/command.c are redundant.
    One block in src/backend/commands/schemacmds.c is not at the right
    place.
---
 src/backend/commands/schemacmds.c   | 24 ++++++++++++------------
 src/backend/storage/ipc/procarray.c |  7 +------
 2 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c
index 93bc2ace73..1a48dc15d7 100644
--- a/src/backend/commands/schemacmds.c
+++ b/src/backend/commands/schemacmds.c
@@ -178,6 +178,18 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString,
 		}
 	}
 
+	/*
+	 * If the requested authorization is different from the current user,
+	 * temporarily set the current user so that the object(s) will be created
+	 * with the correct ownership.
+	 *
+	 * (The setting will be restored at the end of this routine, or in case of
+	 * error, transaction abort will clean things up.)
+	 */
+	if (saved_uid != owner_uid)
+		SetUserIdAndSecContext(owner_uid,
+							   save_sec_context | SECURITY_LOCAL_USERID_CHANGE);
+
 	/* Create the schema's namespace */
 	if (shouldDispatch || Gp_role != GP_ROLE_EXECUTE)
 	{
@@ -237,18 +249,6 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString,
 		}
 	}
 
-	/*
-	 * If the requested authorization is different from the current user,
-	 * temporarily set the current user so that the object(s) will be created
-	 * with the correct ownership.
-	 *
-	 * (The setting will be restored at the end of this routine, or in case of
-	 * error, transaction abort will clean things up.)
-	 */
-	if (saved_uid != owner_uid)
-		SetUserIdAndSecContext(owner_uid,
-							   save_sec_context | SECURITY_LOCAL_USERID_CHANGE);
-
 	/* Advance cmd counter to make the namespace visible */
 	CommandCounterIncrement();
 
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index c872907a46..d56a5847da 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -708,12 +708,6 @@ ProcArrayEndGxact(TMGXACT *tmGxact)
  * the caller to pass latestXid, instead of computing it from the PGPROC's
  * contents, because the subxid information in the PGPROC might be
  * incomplete.)
- *
- * GPDB: If this is a global transaction, we might need to do this action
- * later, rather than now. In that case, this function returns true for
- * needNotifyCommittedDtxTransaction, and does *not* change the state of the
- * PGPROC entry. This can only happen for commit; when !isCommit, this always
- * clears the PGPROC entry.
  */
 void
 ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid)
@@ -726,6 +720,7 @@ ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid)
 			MyProcPort ? MyProcPort->database_name : "",  // databaseName
 			""); // tableName
 #endif
+
 	if (TransactionIdIsValid(latestXid) || TransactionIdIsValid(tmGxact->gxid))
 	{
 		/*


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org