This is an automated email from the ASF dual-hosted git repository. reshke pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 050d37086328d8a421fa4e8549810a394b90a871 Author: reshke <[email protected]> AuthorDate: Sun Feb 15 10:35:19 2026 +0000 Fix for ace9973867c to work in MPP --- contrib/citext/expected/create_index_acl.out | 4 +++- contrib/citext/sql/create_index_acl.sql | 3 ++- src/backend/commands/indexcmds.c | 14 +++++++++----- src/backend/tcop/utility.c | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/contrib/citext/expected/create_index_acl.out b/contrib/citext/expected/create_index_acl.out index f35f60b421d..28602ccfdf3 100644 --- a/contrib/citext/expected/create_index_acl.out +++ b/contrib/citext/expected/create_index_acl.out @@ -7,7 +7,9 @@ -- DefineIndex() uses the table owner userid where necessary.) -- Don't override tablespaces; this version lacks allow_in_place_tablespaces. BEGIN; +SET allow_segment_DML TO true; CREATE ROLE regress_minimal; +NOTICE: resource queue required -- using default resource queue "pg_default" CREATE SCHEMA s; CREATE EXTENSION citext SCHEMA s; -- Revoke all conceivably-relevant ACLs within the extension. The system @@ -42,7 +44,7 @@ REVOKE ALL ON FUNCTION s.index_row_if FROM PUBLIC; GRANT EXECUTE ON FUNCTION s.index_row_if TO regress_minimal; -- Non-extension, non-function objects. CREATE COLLATION s.coll (LOCALE="C"); -CREATE TABLE s.x (y s.citext); +CREATE TABLE s.x (y s.citext) DISTRIBUTED REPLICATED; ALTER TABLE s.x OWNER TO regress_minimal; -- Empty-table DefineIndex() CREATE UNIQUE INDEX u0rows ON s.x USING btree diff --git a/contrib/citext/sql/create_index_acl.sql b/contrib/citext/sql/create_index_acl.sql index a5f4e6b30a8..aedb9d625fc 100644 --- a/contrib/citext/sql/create_index_acl.sql +++ b/contrib/citext/sql/create_index_acl.sql @@ -9,6 +9,7 @@ -- Don't override tablespaces; this version lacks allow_in_place_tablespaces. BEGIN; +SET allow_segment_DML TO true; CREATE ROLE regress_minimal; CREATE SCHEMA s; CREATE EXTENSION citext SCHEMA s; @@ -44,7 +45,7 @@ REVOKE ALL ON FUNCTION s.index_row_if FROM PUBLIC; GRANT EXECUTE ON FUNCTION s.index_row_if TO regress_minimal; -- Non-extension, non-function objects. CREATE COLLATION s.coll (LOCALE="C"); -CREATE TABLE s.x (y s.citext); +CREATE TABLE s.x (y s.citext) DISTRIBUTED REPLICATED; ALTER TABLE s.x OWNER TO regress_minimal; -- Empty-table DefineIndex() CREATE UNIQUE INDEX u0rows ON s.x USING btree diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index ca023623955..7d91d604443 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -1903,6 +1903,10 @@ DefineIndex(Oid relationId, } stmt->idxname = indexRelationName; + + AtEOXact_GUC(false, root_save_nestlevel); + SetUserIdAndSecContext(root_save_userid, root_save_sec_context); + if (shouldDispatch) { /* make sure the QE uses the same index name that we chose */ @@ -1923,8 +1927,6 @@ DefineIndex(Oid relationId, * Indexes on partitioned tables are not themselves built, so we're * done here. */ - AtEOXact_GUC(false, root_save_nestlevel); - SetUserIdAndSecContext(root_save_userid, root_save_sec_context); table_close(rel, NoLock); if (!OidIsValid(parentIndexId)) pgstat_progress_end_command(); @@ -1932,6 +1934,10 @@ DefineIndex(Oid relationId, } stmt->idxname = indexRelationName; + + AtEOXact_GUC(false, root_save_nestlevel); + SetUserIdAndSecContext(root_save_userid, root_save_sec_context); + if (shouldDispatch) { int flags = DF_CANCEL_ON_ERROR | DF_WITH_SNAPSHOT; @@ -1941,6 +1947,7 @@ DefineIndex(Oid relationId, /* make sure the QE uses the same index name that we chose */ stmt->oldNode = InvalidOid; Assert(stmt->relation != NULL); + CdbDispatchUtilityStatement((Node *) stmt, flags, GetAssignedOidsForDispatch(), NULL); @@ -1950,9 +1957,6 @@ DefineIndex(Oid relationId, cdb_sync_indcheckxmin_with_segments(indexRelationId); } - AtEOXact_GUC(false, root_save_nestlevel); - SetUserIdAndSecContext(root_save_userid, root_save_sec_context); - if (!concurrent || Gp_role == GP_ROLE_EXECUTE) { /* Close the heap and we're done, in the non-concurrent case */ diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index 8eefbf93b88..72d4fc4c89b 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -2049,7 +2049,7 @@ ProcessUtilitySlow(ParseState *pstate, /* * The QD might have looked up the OID of the base table - * already, and stashed it in stmt->relid + * already, and stashed it in stmt->relationOid */ if (stmt->relationOid) relid = stmt->relationOid; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
