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 12504da24b0 Fix all compile errors for optimizer
12504da24b0 is described below

commit 12504da24b0f9132702e9072a9bdcaeacdf040a7
Author: Jinbao Chen <chenjinbao1...@gmail.com>
AuthorDate: Sat Sep 27 11:32:12 2025 +0800

    Fix all compile errors for optimizer
---
 src/backend/optimizer/plan/planner.c       | 31 ++++++------------
 src/backend/optimizer/plan/setrefs.c       | 18 ++++++-----
 src/backend/optimizer/plan/subselect.c     |  3 +-
 src/backend/optimizer/prep/prepagg.c       | 13 ++++++--
 src/backend/optimizer/prep/preptlist.c     | 11 ++++---
 src/backend/optimizer/util/clauses.c       | 17 +++++-----
 src/backend/optimizer/util/inherit.c       |  2 +-
 src/backend/optimizer/util/pathnode.c      |  5 +--
 src/include/access/xlogutils.h             |  3 --
 src/include/c.h                            | 51 ++++++++++++++++++++++++++----
 src/include/catalog/gp_matview_aux.h       |  9 ++----
 src/include/catalog/pg_foreign_table_seg.h |  2 +-
 src/include/optimizer/pathnode.h           |  2 +-
 13 files changed, 100 insertions(+), 67 deletions(-)

diff --git a/src/backend/optimizer/plan/planner.c 
b/src/backend/optimizer/plan/planner.c
index 171377b2f43..4e767aaea03 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -42,7 +42,6 @@
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
 #include "nodes/print.h"
-#endif
 #include "nodes/supportnodes.h"
 #include "optimizer/appendinfo.h"
 #include "optimizer/clauses.h"
@@ -1888,7 +1887,6 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
                         */
                        if (target->sortgrouprefs)
                        {
-                               ListCell *lc;
                                int                     idx;
 
                                idx = 0;
@@ -5680,6 +5678,7 @@ create_partial_distinct_paths(PlannerInfo *root, 
RelOptInfo *input_rel,
                                                                                
 cheapest_partial_path->pathtarget,
                                                                                
 AGG_HASHED,
                                                                                
 AGGSPLIT_SIMPLE,
+                                                                               
 false,
                                                                                
 root->processed_distinctClause,
                                                                                
 NIL,
                                                                                
 NULL,
@@ -5735,7 +5734,6 @@ create_final_distinct_paths(PlannerInfo *root, RelOptInfo 
*input_rel,
        bool            allow_hash;
        double          numDistinctRowsTotal;
        double          numInputRowsTotal;
-       bool            allow_hash;
        Path       *path;
        ListCell   *lc;
 
@@ -5779,8 +5777,6 @@ create_final_distinct_paths(PlannerInfo *root, RelOptInfo 
*input_rel,
         */
        if (grouping_is_sortable(root->processed_distinctClause))
        {
-               double          numDistinctRows;
-
                /*
                 * Firstly, if we have any adequately-presorted paths, just 
stick a
                 * Unique node on those.  We also, consider doing an explicit 
sort of
@@ -5796,7 +5792,6 @@ create_final_distinct_paths(PlannerInfo *root, RelOptInfo 
*input_rel,
                 * the other.)
                 */
                List       *needed_pathkeys;
-               ListCell   *lc;
                double          limittuples = root->distinct_pathkeys == NIL ? 
1.0 : -1.0;
 
                if (parse->hasDistinctOn &&
@@ -5881,7 +5876,7 @@ create_final_distinct_paths(PlannerInfo *root, RelOptInfo 
*input_rel,
                                add_path(distinct_rel, (Path *)
                                                 create_limit_path(root, 
distinct_rel, sorted_path,
                                                                                
   NULL, limitCount,
-                                                                               
   LIMIT_OPTION_COUNT, 0, 1));
+                                                                               
   LIMIT_OPTION_COUNT, 0, 1), root);
                        }
                        else
                        {
@@ -5980,7 +5975,6 @@ create_final_distinct_paths(PlannerInfo *root, RelOptInfo 
*input_rel,
        if (allow_hash && grouping_is_hashable(root->processed_distinctClause))
        {
                /* Generate hashed aggregate path --- no sort needed */
-               double          numDistinctRows;
                Size            hashentrysize;
 
                path = cdb_prepare_path_for_hashed_agg(root,
@@ -6131,7 +6125,7 @@ create_ordered_paths(PlannerInfo *root,
                        sorted_path = apply_projection_to_path(root, 
ordered_rel,
                                                                                
                   sorted_path, target);
 
-               add_path(ordered_rel, sorted_path);
+               add_path(ordered_rel, sorted_path, root);
        }
 
        /*
@@ -6208,7 +6202,6 @@ create_ordered_paths(PlannerInfo *root,
                        foreach(lc, input_rel->partial_pathlist)
                        {
                                Path       *input_path = (Path *) lfirst(lc);
-                               Path       *sorted_path;
                                bool            is_sorted;
                                int                     presorted_keys;
 #if 0
@@ -8106,7 +8099,7 @@ add_paths_to_grouping_rel(PlannerInfo *root, RelOptInfo 
*input_rel,
                                                                                
 root->processed_groupClause,
                                                                                
 havingQual,
                                                                                
 agg_costs,
-                                                                               
 dNumGroups));
+                                                                               
 dNumGroups), root);
                        }
 #if 0
                        else if (parse->groupClause)
@@ -8128,8 +8121,8 @@ add_paths_to_grouping_rel(PlannerInfo *root, RelOptInfo 
*input_rel,
                                /* Other cases should have been handled above */
                                Assert(false);
                        }
-               }
 #endif
+               }
                if (grouped_rel->consider_parallel)
                {
                        foreach(lc, input_rel->partial_pathlist)
@@ -8274,7 +8267,7 @@ add_paths_to_grouping_rel(PlannerInfo *root, RelOptInfo 
*input_rel,
                                                                                
         root->processed_groupClause,
                                                                                
         havingQual,
                                                                                
         agg_final_costs,
-                                                                               
         dNumGroups));
+                                                                               
         dNumGroups), root);
 #if 0
                                else
                                        add_path(grouped_rel, (Path *)
@@ -8363,9 +8356,6 @@ add_paths_to_grouping_rel(PlannerInfo *root, RelOptInfo 
*input_rel,
                        }
                        if (input_rel->partial_pathlist && 
grouped_rel->consider_parallel)
                        {
-                               Path       *path = 
linitial(input_rel->partial_pathlist);
-                               double          dNumGroups;
-
                                path = cdb_prepare_path_for_hashed_agg(root,
                                                                                
                                path,
                                                                                
                                path->pathtarget,
@@ -8518,7 +8508,6 @@ add_paths_to_grouping_rel(PlannerInfo *root, RelOptInfo 
*input_rel,
 
                if (gp_eager_two_phase_agg)
                {
-                       ListCell *lc;
                        foreach(lc, grouped_rel->pathlist)
                        {
                                Path *path = (Path *) lfirst(lc);
@@ -8825,10 +8814,11 @@ create_partial_grouping_paths(PlannerInfo *root,
                                                                                
 partially_grouped_rel->reltarget,
                                                                                
 parse->groupClause ? AGG_SORTED : AGG_PLAIN,
                                                                                
 AGGSPLIT_INITIAL_SERIAL,
+                                                                               
 false,
                                                                                
 root->processed_groupClause,
                                                                                
 NIL,
                                                                                
 agg_partial_costs,
-                                                                               
 dNumPartialGroups));
+                                                                               
 dNumPartialGroups), root);
                        else
                                add_path(partially_grouped_rel, (Path *)
                                                 create_group_path(root,
@@ -8836,7 +8826,7 @@ create_partial_grouping_paths(PlannerInfo *root,
                                                                                
   path,
                                                                                
   root->processed_groupClause,
                                                                                
   NIL,
-                                                                               
   dNumPartialGroups));
+                                                                               
   dNumPartialGroups), root);
                }
        }
 
@@ -8914,9 +8904,6 @@ create_partial_grouping_paths(PlannerInfo *root,
                        if (is_sorted || !enable_incremental_sort)
                                continue;
 
-                       /* Restore the input path (we might have added Sort on 
top). */
-                       path = path_original;
-
                        /* no shared prefix, not point in building incremental 
sort */
                        if (presorted_keys == 0)
                                continue;
diff --git a/src/backend/optimizer/plan/setrefs.c 
b/src/backend/optimizer/plan/setrefs.c
index ff2b46d1d0a..e2283266c60 100644
--- a/src/backend/optimizer/plan/setrefs.c
+++ b/src/backend/optimizer/plan/setrefs.c
@@ -779,8 +779,8 @@ set_plan_refs(PlannerInfo *root, Plan *plan, int rtoffset)
 
                                /* If the scan appears below a shareinput, we 
hit this assert. */
 #ifdef USE_ASSERT_CHECKING
-                               Assert(splan->scanrelid <= 
list_length(root->glob->finalrtable) && "Scan node's relid is outside the 
finalrtable!");
-                               RangeTblEntry *rte = rt_fetch(splan->scanrelid, 
root->glob->finalrtable);
+                               Assert(splan->scan.scanrelid <= 
list_length(root->glob->finalrtable) && "Scan node's relid is outside the 
finalrtable!");
+                               RangeTblEntry *rte = 
rt_fetch(splan->scan.scanrelid, root->glob->finalrtable);
                                Assert((rte->rtekind == RTE_RELATION || 
rte->rtekind == RTE_CTE) && "Scan plan should refer to a scan relation");
 #endif
                                splan->scan.plan.targetlist =
@@ -1153,10 +1153,10 @@ set_plan_refs(PlannerInfo *root, Plan *plan, int 
rtoffset)
 
                                                        
pinfo->initial_pruning_steps = (List *)
                                                                
fix_upper_expr(root, (Node *) pinfo->initial_pruning_steps,
-                                                                               
           childplan_itlist, OUTER_VAR, rtoffset, 1);
+                                                                               
           childplan_itlist, OUTER_VAR, rtoffset, NRM_EQUAL, 1);
                                                        
pinfo->exec_pruning_steps = (List *)
                                                                
fix_upper_expr(root, (Node *) pinfo->exec_pruning_steps,
-                                                                               
           childplan_itlist, OUTER_VAR, rtoffset,
+                                                                               
           childplan_itlist, OUTER_VAR, rtoffset, NRM_EQUAL,
                                                                                
           NUM_EXEC_QUAL(plan));
                                                }
                                        }
@@ -1262,6 +1262,7 @@ set_plan_refs(PlannerInfo *root, Plan *plan, int rtoffset)
                                                                                
                                                 subplan_itlist,
                                                                                
                                                 OUTER_VAR,
                                                                                
                                                 rtoffset,
+                                                                               
                                                 NRM_EQUAL,
                                                                                
                                                 NUM_EXEC_QUAL(plan));
 
                                        lfirst(lc) = dqaExpr;
@@ -1304,10 +1305,10 @@ set_plan_refs(PlannerInfo *root, Plan *plan, int 
rtoffset)
 
                                        wplan->startOffset =
                                                fix_upper_expr(root, 
wplan->startOffset,
-                                                                          
subplan_itlist, OUTER_VAR, rtoffset, 1);
+                                                                          
subplan_itlist, OUTER_VAR, rtoffset, NRM_EQUAL, 1);
                                        wplan->endOffset =
                                                fix_upper_expr(root, 
wplan->endOffset,
-                                                                          
subplan_itlist, OUTER_VAR, rtoffset, 1);
+                                                                          
subplan_itlist, OUTER_VAR, rtoffset, NRM_EQUAL, 1);
                                        pfree(subplan_itlist);
                                }
                                wplan->runCondition = fix_scan_list(root,
@@ -1601,7 +1602,7 @@ set_plan_refs(PlannerInfo *root, Plan *plan, int rtoffset)
                                motion->hashExprs = (List *)
                                        fix_upper_expr(root, (Node*) 
motion->hashExprs,
                                                                   
childplan_itlist,  OUTER_VAR,
-                                                                  rtoffset, 
NUM_EXEC_QUAL(plan));
+                                                                  rtoffset, 
NRM_EQUAL, NUM_EXEC_QUAL(plan));
 
                                /* no need to fix targetlist and qual */
                                Assert(plan->qual == NIL);
@@ -1700,6 +1701,7 @@ set_indexonlyscan_references(PlannerInfo *root,
                                           index_itlist,
                                           INDEX_VAR,
                                           rtoffset,
+                                          NRM_EQUAL,
                                           NUM_EXEC_QUAL((Plan *) plan));
 
        plan->indexqual = fix_scan_list(root, plan->indexqual,
@@ -2756,7 +2758,6 @@ set_join_references(PlannerInfo *root, Join *join, int 
rtoffset)
                                                                                
inner_itlist,
                                                                                
(Index) 0,
                                                                                
rtoffset,
-                                                                               
NRM_EQUAL,
                                                                                
NUM_EXEC_QUAL((Plan *) join));
 
                hj->hashqualclauses = fix_join_expr(root,
@@ -2765,6 +2766,7 @@ set_join_references(PlannerInfo *root, Join *join, int 
rtoffset)
                                                                                
        inner_itlist,
                                                                                
        (Index) 0,
                                                                                
        rtoffset,
+                                                                               
        NRM_EQUAL,
                                                                                
        NUM_EXEC_QUAL((Plan *) join));
                /*
                 * HashJoin's hashkeys are used to look for matching tuples 
from its
diff --git a/src/backend/optimizer/plan/subselect.c 
b/src/backend/optimizer/plan/subselect.c
index e01ec1cf2cd..dc2bc965dcc 100644
--- a/src/backend/optimizer/plan/subselect.c
+++ b/src/backend/optimizer/plan/subselect.c
@@ -2766,7 +2766,7 @@ finalize_plan(PlannerInfo *root, Plan *plan,
                        }
 
                        upperset = bms_difference(extset, parentset);
-                       while ((paramid = bms_first_member(upperset)) >= 0)
+                       while ((paramid = bms_next_member(upperset, -1)) >= 0)
                                initsubplan->extParam = 
lappend_int(initsubplan->extParam, paramid);
                }
        }
@@ -3293,7 +3293,6 @@ finalize_plan(PlannerInfo *root, Plan *plan,
                        break;
 
                case T_ProjectSet:
-               case T_Hash:
                case T_RuntimeFilter:
                case T_Material:
                case T_Sort:
diff --git a/src/backend/optimizer/prep/prepagg.c 
b/src/backend/optimizer/prep/prepagg.c
index 8e7e8492839..3a93f0a0b44 100644
--- a/src/backend/optimizer/prep/prepagg.c
+++ b/src/backend/optimizer/prep/prepagg.c
@@ -578,9 +578,16 @@ get_agg_clause_costs(PlannerInfo *root, AggSplit aggsplit, 
AggClauseCosts *costs
        foreach(lc, root->agginfos)
        {
                AggInfo    *agginfo = (AggInfo *) lfirst(lc);
-               Aggref     *aggref = agginfo->representative_aggref;
-               if (aggref->aggdistinct != NIL)
-                       costs->distinctAggrefs = 
lappend(costs->distinctAggrefs, aggref);
+               List       *aggrefs = agginfo->aggrefs;
+               ListCell   *lc2;
+
+               foreach(lc2, aggrefs)
+               {
+                       Aggref *aggref = lfirst(lc2);
+
+                       if (aggref->aggdistinct != NIL)
+                               costs->distinctAggrefs = 
lappend(costs->distinctAggrefs, aggref);
+               }
        }
 }
 
diff --git a/src/backend/optimizer/prep/preptlist.c 
b/src/backend/optimizer/prep/preptlist.c
index c06fec12b64..321d6b202aa 100644
--- a/src/backend/optimizer/prep/preptlist.c
+++ b/src/backend/optimizer/prep/preptlist.c
@@ -138,7 +138,7 @@ preprocess_targetlist(PlannerInfo *root)
                                target_rte->relkind != 
RELKIND_PARTITIONED_TABLE)
                                ereport(ERROR, (errmsg("can't split update for 
inherit table: %s",
                                                                
RelationGetRelationName(target_relation))));
-                       tlist = expand_insert_targetlist(tlist, 
target_relation, result_relation);
+                       tlist = expand_insert_targetlist(root, tlist, 
target_relation, result_relation);
                }
        }
 
@@ -190,10 +190,11 @@ preprocess_targetlist(PlannerInfo *root)
                        if (action->commandType == CMD_INSERT)
                                action->targetList = 
expand_insert_targetlist(root,
                                                                                
                                          action->targetList,
-                                                                               
                                          target_relation);
+                                                                               
                                          target_relation,
+                                                                               
                                          result_relation);
                        else if (action->commandType == CMD_UPDATE)
                                action->updateColnos =
-                                       
extract_update_targetlist_colnos(action->targetList);
+                                       
extract_update_targetlist_colnos(action->targetList, false);
 
                        /*
                         * Add resjunk entries for any Vars and PlaceHolderVars 
used in
@@ -457,6 +458,8 @@ expand_insert_targetlist(PlannerInfo *root, List *tlist, 
Relation rel, Index spl
                         * Again, code comparing the finished plan to the 
target relation
                         * must account for this.
                         */
+                       Oid                     atttype = att_tup->atttypid;
+                       Oid                     attcollation = 
att_tup->attcollation;
                        Node       *new_expr;
 
                        if (!att_tup->attisdropped)
@@ -488,7 +491,7 @@ expand_insert_targetlist(PlannerInfo *root, List *tlist, 
Relation rel, Index spl
                                                                                
        false);
                                }
                        }
-                       else
+                       else if (att_tup->attgenerated)
                        {
                                /* Insert NULL for dropped column */
                                new_expr = (Node *) makeConst(INT4OID,
diff --git a/src/backend/optimizer/util/clauses.c 
b/src/backend/optimizer/util/clauses.c
index 99e092dd70a..20a1c8a1d57 100644
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -5737,35 +5737,36 @@ flatten_join_alias_var_optimizer(Query *query, int 
queryLevel)
        List *targetList = queryNew->targetList;
        if (NIL != targetList)
        {
-               queryNew->targetList = (List *) 
flatten_join_alias_vars(queryNew, (Node *) targetList);
+               /*.MERGE16_FIXME: We should not use null here */
+               queryNew->targetList = (List *) flatten_join_alias_vars(NULL, 
queryNew, (Node *) targetList);
                list_free(targetList);
        }
 
        List * returningList = queryNew->returningList;
        if (NIL != returningList)
        {
-               queryNew->returningList = (List *) 
flatten_join_alias_vars(queryNew, (Node *) returningList);
+               queryNew->returningList = (List *) 
flatten_join_alias_vars(NULL, queryNew, (Node *) returningList);
                list_free(returningList);
        }
 
        Node *havingQual = queryNew->havingQual;
        if (NULL != havingQual)
        {
-               queryNew->havingQual = flatten_join_alias_vars(queryNew, 
havingQual);
+               queryNew->havingQual = flatten_join_alias_vars(NULL, queryNew, 
havingQual);
                pfree(havingQual);
        }
 
        List *scatterClause = queryNew->scatterClause;
        if (NIL != scatterClause)
        {
-               queryNew->scatterClause = (List *) 
flatten_join_alias_vars(queryNew, (Node *) scatterClause);
+               queryNew->scatterClause = (List *) 
flatten_join_alias_vars(NULL, queryNew, (Node *) scatterClause);
                list_free(scatterClause);
        }
 
        Node *limitOffset = queryNew->limitOffset;
        if (NULL != limitOffset)
        {
-               queryNew->limitOffset = flatten_join_alias_vars(queryNew, 
limitOffset);
+               queryNew->limitOffset = flatten_join_alias_vars(NULL, queryNew, 
limitOffset);
                pfree(limitOffset);
        }
 
@@ -5782,17 +5783,17 @@ flatten_join_alias_var_optimizer(Query *query, int 
queryLevel)
                                continue;
 
                        if (wc->startOffset)
-                               wc->startOffset = 
flatten_join_alias_vars(queryNew, wc->startOffset);
+                               wc->startOffset = flatten_join_alias_vars(NULL, 
queryNew, wc->startOffset);
 
                        if (wc->endOffset)
-                               wc->endOffset = 
flatten_join_alias_vars(queryNew, wc->endOffset);
+                               wc->endOffset = flatten_join_alias_vars(NULL, 
queryNew, wc->endOffset);
                }
        }
 
        Node *limitCount = queryNew->limitCount;
        if (NULL != limitCount)
        {
-               queryNew->limitCount = flatten_join_alias_vars(queryNew, 
limitCount);
+               queryNew->limitCount = flatten_join_alias_vars(NULL, queryNew, 
limitCount);
                pfree(limitCount);
        }
 
diff --git a/src/backend/optimizer/util/inherit.c 
b/src/backend/optimizer/util/inherit.c
index c682e30164c..c56685c0aad 100644
--- a/src/backend/optimizer/util/inherit.c
+++ b/src/backend/optimizer/util/inherit.c
@@ -391,7 +391,7 @@ expand_partitioned_rtentry(PlannerInfo *root, RelOptInfo 
*relinfo,
                 * detached and subsequently dropped, then opening it will 
fail.  In
                 * this case, behave as though the partition had been pruned.
                 */
-               childrel = try_table_open(childOID, lockmode);
+               childrel = try_table_open(childOID, lockmode, false);
                if (childrel == NULL)
                {
                        relinfo->live_parts = 
bms_del_member(relinfo->live_parts, i);
diff --git a/src/backend/optimizer/util/pathnode.c 
b/src/backend/optimizer/util/pathnode.c
index 3324ca120fc..1d276a1edc7 100644
--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -2089,7 +2089,8 @@ set_append_path_locus(PlannerInfo *root, Path *pathnode, 
RelOptInfo *rel,
                                                                                
                  (Expr *) makeSegmentFilterExpr(
                                                                                
                          gp_session_id % numsegments),
                                                                                
                  true,         /* is_pushed_down */
-                                                                               
                  false,        /* outerjoin_delayed */
+                                                                               
                  false,        /* has_clone */
+                                                                               
                  false,        /*.is_clone */
                                                                                
                  true,         /* pseudoconstant */
                                                                                
                  0,            /* security_level */
                                                                                
                  NULL,         /* required_relids */
@@ -5107,7 +5108,7 @@ create_agg_path(PlannerInfo *root,
        }
        else
                pathnode->path.pathkeys = NIL;  /* output is unordered */
-       pathnode->path.barrierHazard = subpath->barrierHazard;9
+       pathnode->path.barrierHazard = subpath->barrierHazard;
        pathnode->subpath = subpath;
        pathnode->streaming = streaming;
 
diff --git a/src/include/access/xlogutils.h b/src/include/access/xlogutils.h
index 091e9d4bbcc..5cc398909bc 100644
--- a/src/include/access/xlogutils.h
+++ b/src/include/access/xlogutils.h
@@ -121,9 +121,6 @@ extern void XLogReadDetermineTimeline(XLogReaderState 
*state,
 
 extern void XLogAOSegmentFile(RelFileNode rnode, uint32 segmentFileNum);
 
-extern void XLogReadDetermineTimeline(XLogReaderState *state,
-                                       XLogRecPtr wantPage, uint32 wantLength);
-
 extern void WALReadRaiseError(WALReadError *errinfo);
 
 #endif
diff --git a/src/include/c.h b/src/include/c.h
index ae7d1c0fba8..23489c2c946 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -904,8 +904,8 @@ typedef NameData *Name;
 #define AssertPointerAlignment(ptr, bndr)      ((void)true)
 #define AssertImply(condition1, condition2)    ((void)true)
 #define AssertEquivalent(cond1, cond2) ((void)true)
-#define Trap(condition, errorType)     ((void)true)
-#define TrapMacro(condition, errorType) (true)
+#define Trap(condition)        ((void)true)
+#define TrapMacro(condition) (true)
 
 #elif defined(FRONTEND)
 
@@ -915,6 +915,29 @@ typedef NameData *Name;
 
 #else                                                  /* USE_ASSERT_CHECKING 
&& !FRONTEND */
 
+/*
+ * Trap
+ *             Generates an exception if the given condition is true.
+ */
+#define Trap(condition) \
+       do { \
+               if (condition) \
+                       ExceptionalCondition(#condition, \
+                                                                __FILE__, 
__LINE__); \
+       } while (0)
+
+/*
+ *     TrapMacro is the same as Trap but it's intended for use in macros:
+ *
+ *             #define foo(x) (AssertMacro(x != 0), bar(x))
+ *
+ *     Isn't CPP fun?
+ */
+#define TrapMacro(condition) \
+       ((bool) (! (condition) || \
+                        (ExceptionalCondition(#condition, \
+                                                                  __FILE__, 
__LINE__), 0)))
+
 /*
  * Assert
  *             Generates a fatal exception if the given condition is false.
@@ -935,19 +958,35 @@ typedef NameData *Name;
        ((void) ((condition) || \
                         (ExceptionalCondition(#condition, __FILE__, __LINE__), 
0)))
 
-#endif                                                 /* USE_ASSERT_CHECKING 
&& !FRONTEND */
-
 #define AssertImply(cond1, cond2) \
-               Trap(!(!(cond1) || (cond2)), "AssertImply failed")
+               Trap(!(!(cond1) || (cond2)))
 
 #define AssertEquivalent(cond1, cond2) \
-               Trap(!((bool)(cond1) == (bool)(cond2)), "AssertEquivalent 
failed")
+               Trap(!((bool)(cond1) == (bool)(cond2)))
+
+
+#define AssertArg(condition) \
+       do { \
+               if (!(condition)) \
+                       ExceptionalCondition(#condition, \
+                                                                __FILE__, 
__LINE__); \
+       } while (0)
+
+#define AssertState(condition) \
+       do { \
+               if (!(condition)) \
+                       ExceptionalCondition(#condition, \
+                                                                __FILE__, 
__LINE__); \
+       } while (0)
+
 
 /*
  * Check that `ptr' is `bndr' aligned.
  */
 #define AssertPointerAlignment(ptr, bndr) \
        Assert(TYPEALIGN(bndr, (uintptr_t)(ptr)) == (uintptr_t)(ptr))
+#endif                                                 /* USE_ASSERT_CHECKING 
&& !FRONTEND */
+
 
 /*
  * ExceptionalCondition is compiled into the backend whether or not
diff --git a/src/include/catalog/gp_matview_aux.h 
b/src/include/catalog/gp_matview_aux.h
index bec990f8b81..f22d98bc6ad 100644
--- a/src/include/catalog/gp_matview_aux.h
+++ b/src/include/catalog/gp_matview_aux.h
@@ -58,14 +58,11 @@ CATALOG(gp_matview_aux,7153,GpMatviewAuxId)
  */
 typedef FormData_gp_matview_aux *Form_gp_matview_aux;
 
-DECLARE_UNIQUE_INDEX(gp_matview_aux_mvoid_index, 7147, on gp_matview_aux using 
btree(mvoid oid_ops));
-#define GpMatviewAuxMvoidIndexId 7147
+DECLARE_UNIQUE_INDEX(gp_matview_aux_mvoid_index, 7147, 
GpMatviewAuxMvoidIndexId, on gp_matview_aux using btree(mvoid oid_ops));
 
-DECLARE_INDEX(gp_matview_aux_mvname_index, 7148, on gp_matview_aux using 
btree(mvname name_ops));
-#define GpMatviewAuxMvnameIndexId 7148
+DECLARE_INDEX(gp_matview_aux_mvname_index, 7148, GpMatviewAuxMvnameIndexId, on 
gp_matview_aux using btree(mvname name_ops));
 
-DECLARE_INDEX(gp_matview_aux_datastatus_index, 7149, on gp_matview_aux using 
btree(datastatus char_ops));
-#define GpMatviewAuxDatastatusIndexId 7149
+DECLARE_INDEX(gp_matview_aux_datastatus_index, 7149, 
GpMatviewAuxDatastatusIndexId, on gp_matview_aux using btree(datastatus 
char_ops));
 
 #define                MV_DATA_STATUS_UP_TO_DATE                               
'u'     /* data is up to date */
 #define                MV_DATA_STATUS_UP_REORGANIZED                   'r' /* 
data is up to date, but reorganized. VACUUM FULL/CLUSTER */
diff --git a/src/include/catalog/pg_foreign_table_seg.h 
b/src/include/catalog/pg_foreign_table_seg.h
index 717de444618..b1174db9290 100644
--- a/src/include/catalog/pg_foreign_table_seg.h
+++ b/src/include/catalog/pg_foreign_table_seg.h
@@ -21,7 +21,7 @@ CATALOG(pg_foreign_table_seg,5110,ForeignTableRelationSegId)
 
 typedef FormData_pg_foreign_table_seg *Form_pg_foreign_table_seg;
 
-DECLARE_INDEX(pg_foreign_table_seg_relid_index, 5111, on pg_foreign_table_seg 
using btree(ftsrelid oid_ops));
+DECLARE_INDEX(pg_foreign_table_seg_relid_index, 5111, 
ForeignTableRelationSegIndexId, on pg_foreign_table_seg using btree(ftsrelid 
oid_ops));
 
 #define GP_FOREIGN_SERVER_ID_FUNC 6024
 
diff --git a/src/include/optimizer/pathnode.h b/src/include/optimizer/pathnode.h
index cb4382e6e1d..4bcb638f978 100644
--- a/src/include/optimizer/pathnode.h
+++ b/src/include/optimizer/pathnode.h
@@ -367,8 +367,8 @@ extern RelOptInfo *build_join_rel(PlannerInfo *root,
                                                                  RelOptInfo 
*outer_rel,
                                                                  RelOptInfo 
*inner_rel,
                                                                  
SpecialJoinInfo *sjinfo,
-                                                                 List 
*pushed_down_joins,
                                                                  List 
**restrictlist_ptr,
+                                                                 List 
*pushed_down_joins,
                                                                  RelAggInfo 
*agg_info);
 extern RelOptInfo *build_base_grouped_rel(PlannerInfo *root, RelOptInfo *rel,
                                                                                
        RelAggInfo **agg_info_p);


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

Reply via email to