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


The following commit(s) were added to refs/heads/main by this push:
     new 66eedec0332 Fix analyze paritioned table in somecase will coredump.
66eedec0332 is described below

commit 66eedec0332aaebf7ac7bb8637816859b667a0cd
Author: zhangwenchao <[email protected]>
AuthorDate: Mon Nov 17 15:15:35 2025 +0800

    Fix analyze paritioned table in somecase will coredump.
    
    Fix leaf_parts_analyzed will return false directly without execute analyze 
when
    reltuples is 0 and relpages is 0 that means the table is an empty partition 
table.
    
    Authored-by: Zhang Wenchao <[email protected]>
---
 src/backend/commands/analyzeutils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/backend/commands/analyzeutils.c 
b/src/backend/commands/analyzeutils.c
index c0d048c9a64..c4f9fa5dedb 100644
--- a/src/backend/commands/analyzeutils.c
+++ b/src/backend/commands/analyzeutils.c
@@ -1252,9 +1252,10 @@ leaf_parts_analyzed(Oid attrelid, Oid relid_exclude, 
List *va_cols, int elevel)
                        continue;
 
                float4          relTuples = get_rel_reltuples(partRelid);
+               int32           relpages = get_rel_relpages(partRelid);
 
                /* Partition is not analyzed */
-               if (relTuples < 0.0)
+               if (relTuples < 0.0 || (relTuples == 0.0 && relpages == 0))
                {
                        if (relid_exclude == InvalidOid)
                                ereport(elevel,


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

Reply via email to