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 59289767803 Do not get relation info for partition table
59289767803 is described below

commit 592897678036b5e39e081178dddebd49415428d6
Author: Jinbao Chen <[email protected]>
AuthorDate: Sat Nov 1 11:29:02 2025 +0800

    Do not get relation info for partition table
---
 src/backend/commands/tablecmds.c         |  1 +
 src/backend/commands/tablespace.c        |  2 +-
 src/backend/commands/user.c              |  3 ---
 src/backend/optimizer/util/plancat.c     | 10 ++++++++++
 src/backend/utils/cache/relcache.c       |  6 ++++--
 src/include/utils/rel.h                  |  2 +-
 src/test/regress/expected/tablespace.out |  7 -------
 src/test/regress/serial_schedule         |  2 +-
 8 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 08cf9a5c083..3077c6d4aa1 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -5495,6 +5495,7 @@ ATController(AlterTableStmt *parsetree,
                         * them here.
                         */
                        AlteredTableInfo *tab = (AlteredTableInfo *) lfirst(lc);
+                       Relation rel;
 
                        rel = relation_open(tab->relid, lockmode);
                        tab->oldDesc = 
CreateTupleDescCopyConstr(RelationGetDescr(rel));
diff --git a/src/backend/commands/tablespace.c 
b/src/backend/commands/tablespace.c
index a8674513b86..8224b67f135 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -204,7 +204,7 @@ TablespaceCreateDbspace(Oid spcOid, Oid dbOid, bool isRedo)
                        else
                        {
                                /* Directory creation failed? */
-                               if (MakePGDirectory(dir) < 0)
+                               if (pg_mkdir_p(dir, S_IRWXU) < 0)
                                {
                                        /* Failure other than not exists or not 
in WAL replay? */
                                        if (errno != ENOENT || !isRedo)
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index 2bca6b1090f..89b400ab533 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -448,9 +448,6 @@ CreateRole(ParseState *pstate, CreateRoleStmt *stmt)
        if (denableProfile)
                enable_profile = intVal(denableProfile->arg) != 0;
 
-
-       bypassrls = boolVal(dbypassRLS->arg);
-
        /*
         * Only the super user has the privileges of profile.
         */
diff --git a/src/backend/optimizer/util/plancat.c 
b/src/backend/optimizer/util/plancat.c
index c4622ae5c52..29f4994051a 100644
--- a/src/backend/optimizer/util/plancat.c
+++ b/src/backend/optimizer/util/plancat.c
@@ -262,6 +262,16 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, 
bool inhparent,
                                continue;
                        }
 
+                       /*
+                        * Ignore partitioned indexes, since they are not 
usable for
+                        * queries.
+                        */
+                       if (indexRelation->rd_rel->relkind == 
RELKIND_PARTITIONED_INDEX)
+                       {
+                               index_close(indexRelation, NoLock);
+                               continue;
+                       }
+
                        /*
                         * If the index is valid, but cannot yet be used, 
ignore it; but
                         * mark the plan we are generating as transient. See
diff --git a/src/backend/utils/cache/relcache.c 
b/src/backend/utils/cache/relcache.c
index 313e6c1dc2e..812782aabd1 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -1232,8 +1232,10 @@ retry:
        else if (RELKIND_HAS_TABLE_AM(relation->rd_rel->relkind) ||
                         relation->rd_rel->relkind == RELKIND_SEQUENCE)
                RelationInitTableAccessMethod(relation);
-       else
-               Assert(relation->rd_rel->relam == InvalidOid);
+       /* gp partition tables may set access method for its children */
+       
+//     else
+//             Assert(relation->rd_rel->relam == InvalidOid);
 
        /*
         * If it's an append-only table, get information from pg_appendonly.
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index b1cf6ec01f4..a6e5412c7c5 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -775,7 +775,7 @@ RelationCloseSmgr(Relation relation)
  * that do not use shared/local buffers.
  */
 #define RelationUsesBufferManager(relation) \
-       ((relation)->rd_smgr->smgr_which == SMGR_MD)
+       (RelationGetSmgr(relation)->smgr_which == SMGR_MD)
 
 /*
  * RelationUsesTempNamespace
diff --git a/src/test/regress/expected/tablespace.out 
b/src/test/regress/expected/tablespace.out
index aebd89753bc..c0cb5bebe42 100644
--- a/src/test/regress/expected/tablespace.out
+++ b/src/test/regress/expected/tablespace.out
@@ -1,9 +1,3 @@
-<<<<<<< HEAD:src/test/regress/output/tablespace.source
--- start_matchignore
--- m/WARNING:  tablespace symlink path is too long for TAR/
--- m/DETAIL:  The symlinked path \".*\" will be truncated to 100 characters 
when sending a TAR to the utilities \(e.g. pg_basebackup\)/
--- end_matchignore
-=======
 -- relative tablespace locations are not allowed
 CREATE TABLESPACE regress_tblspace LOCATION 'relative'; -- fail
 ERROR:  tablespace location must be an absolute path
@@ -15,7 +9,6 @@ ERROR:  tablespace location must be an absolute path
 -- can be allowed as a way to say that the tablespace should be created
 -- as a directory in pg_tblspc, rather than being a symlink
 SET allow_in_place_tablespaces = true;
->>>>>>> REL_16_9:src/test/regress/expected/tablespace.out
 -- create a tablespace using WITH clause
 CREATE TABLESPACE regress_tblspacewith LOCATION '' WITH 
(some_nonexistent_parameter = true); -- fail
 ERROR:  unrecognized parameter "some_nonexistent_parameter"
diff --git a/src/test/regress/serial_schedule b/src/test/regress/serial_schedule
index 230f67fe32e..68d824bc119 100644
--- a/src/test/regress/serial_schedule
+++ b/src/test/regress/serial_schedule
@@ -1,7 +1,7 @@
 # src/test/regress/serial_schedule
 # This should probably be in an order similar to parallel_schedule.
 test: test_setup
-# test: tablespace
+test: tablespace
 test: boolean
 test: char
 test: name


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to