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 860d0508442 Set constraint_exclusion to CONSTRAINT_EXCLUSION_ON
860d0508442 is described below

commit 860d050844237daeeb7eec565d0c4a8a544cd612
Author: Jinbao Chen <[email protected]>
AuthorDate: Sun Jan 4 20:18:04 2026 +0800

    Set constraint_exclusion to CONSTRAINT_EXCLUSION_ON
---
 src/backend/utils/misc/guc_tables.c             |  2 +-
 src/test/regress/expected/bfv_aggregate.out     | 41 ++++++-------
 src/test/regress/expected/join.out              | 19 +++---
 src/test/regress/expected/join_gp.out           | 19 ++----
 src/test/regress/expected/partition_pruning.out | 80 +++++++++++++++----------
 src/test/regress/expected/subselect_gp.out      | 38 +++---------
 src/test/regress/expected/update_gp.out         | 14 ++---
 7 files changed, 96 insertions(+), 117 deletions(-)

diff --git a/src/backend/utils/misc/guc_tables.c 
b/src/backend/utils/misc/guc_tables.c
index 43c68db92cc..3b6e18f37ff 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -4744,7 +4744,7 @@ struct config_enum ConfigureNamesEnum[] =
                        GUC_EXPLAIN
                },
                &constraint_exclusion,
-               CONSTRAINT_EXCLUSION_PARTITION, constraint_exclusion_options,
+               CONSTRAINT_EXCLUSION_ON, constraint_exclusion_options,
                NULL, NULL, NULL
        },
 
diff --git a/src/test/regress/expected/bfv_aggregate.out 
b/src/test/regress/expected/bfv_aggregate.out
index e80bd8e5405..b38871afb89 100644
--- a/src/test/regress/expected/bfv_aggregate.out
+++ b/src/test/regress/expected/bfv_aggregate.out
@@ -1590,16 +1590,18 @@ create temp table mpp14125 as select repeat('a', a) a, 
a % 10 b from generate_se
 NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 
'a' as the Apache Cloudberry data distribution key for this table.
 HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make 
sure column(s) chosen are the optimal data distribution key to minimize skew.
 explain select string_agg(a, '') from mpp14125 group by b;
-                                           QUERY PLAN                          
                 
-------------------------------------------------------------------------------------------------
- Gather Motion 3:1  (slice1; segments: 3)  (cost=6.50..6.83 rows=10 width=36)
-   ->  HashAggregate  (cost=6.50..6.62 rows=4 width=36)
+                                              QUERY PLAN                       
                       
+------------------------------------------------------------------------------------------------------
+ Gather Motion 3:1  (slice1; segments: 3)  (cost=322.00..339.50 rows=1000 
width=36)
+   ->  Finalize HashAggregate  (cost=322.00..326.17 rows=333 width=36)
          Group Key: b
-         ->  Redistribute Motion 3:3  (slice2; segments: 3)  (cost=0.00..6.00 
rows=34 width=55)
+         ->  Redistribute Motion 3:3  (slice2; segments: 3)  
(cost=282.00..314.50 rows=1000 width=36)
                Hash Key: b
-               ->  Seq Scan on mpp14125  (cost=0.00..4.00 rows=34 width=55)
+               ->  Partial HashAggregate  (cost=282.00..294.50 rows=1000 
width=36)
+                     Group Key: b
+                     ->  Seq Scan on mpp14125  (cost=0.00..199.33 rows=16533 
width=36)
  Optimizer: Postgres query optimizer
-(7 rows)
+(9 rows)
 
 -- end MPP-14125
 -- Test that integer AVG() aggregate is accurate with large values. We used to
@@ -1775,14 +1777,12 @@ explain (costs off)
 select 1, sum(col1) from group_by_const group by 1;
                    QUERY PLAN                   
 ------------------------------------------------
- Finalize GroupAggregate
-   Group Key: 1
+ Finalize Aggregate
    ->  Gather Motion 3:1  (slice1; segments: 3)
-         ->  Partial GroupAggregate
-               Group Key: 1
+         ->  Partial Aggregate
                ->  Seq Scan on group_by_const
  Optimizer: Postgres query optimizer
-(7 rows)
+(5 rows)
 
 select 1, sum(col1) from group_by_const group by 1;
  ?column? |  sum   
@@ -1794,16 +1794,13 @@ select 1, sum(col1) from group_by_const group by 1;
 -- that you get a one-phase aggregate plan.
 explain (costs off)
 select 1, median(col1) from group_by_const group by 1;
-                         QUERY PLAN                         
-------------------------------------------------------------
- Gather Motion 3:1  (slice1; segments: 3)
-   ->  GroupAggregate
-         Group Key: 1
-         ->  Redistribute Motion 3:3  (slice2; segments: 3)
-               Hash Key: 1
-               ->  Seq Scan on group_by_const
+                   QUERY PLAN                   
+------------------------------------------------
+ GroupAggregate
+   ->  Gather Motion 3:1  (slice1; segments: 3)
+         ->  Seq Scan on group_by_const
  Optimizer: Postgres query optimizer
-(7 rows)
+(4 rows)
 
 select 1, median(col1) from group_by_const group by 1;
  ?column? | median 
@@ -1869,7 +1866,7 @@ explain select count(distinct b)  from t1_replicated 
group by a;
    ->  GroupAggregate  (cost=5519.77..5984.27 rows=1000 width=12)
          Group Key: a
          ->  Sort  (cost=5519.77..5671.27 rows=60600 width=8)
-               Sort Key: a
+               Sort Key: a, b
                ->  Seq Scan on t1_replicated  (cost=0.00..706.00 rows=60600 
width=8)
  Optimizer: Postgres query optimizer
 (7 rows)
diff --git a/src/test/regress/expected/join.out 
b/src/test/regress/expected/join.out
index 2e74904fe89..c75b2ef2302 100644
--- a/src/test/regress/expected/join.out
+++ b/src/test/regress/expected/join.out
@@ -2856,9 +2856,11 @@ select count(*) from
                ->  Gather Motion 3:1  (slice2; segments: 3)
                      Merge Key: y.unique2
                      ->  Subquery Scan on y
-                           ->  Index Scan using tenk1_unique2 on tenk1 y_1
+                           ->  Sort
+                                 Sort Key: y_1.unique2
+                                 ->  Seq Scan on tenk1 y_1
  Optimizer: Postgres query optimizer
-(16 rows)
+(18 rows)
 
 select count(*) from
   (select * from tenk1 x order by x.thousand, x.twothousand, x.fivethous) x
@@ -6483,15 +6485,12 @@ explain (costs off)
 select p.* from
   parent p left join child c on (p.k = c.k)
   where p.k = 1 and p.k = 2;
-                      QUERY PLAN                      
-------------------------------------------------------
- Gather Motion 1:1  (slice1; segments: 1)
-   ->  Result
-         One-Time Filter: false
-         ->  Index Scan using parent_pkey on parent p
-               Index Cond: (k = 1)
+             QUERY PLAN              
+-------------------------------------
+ Result
+   One-Time Filter: false
  Optimizer: Postgres query optimizer
-(6 rows)
+(3 rows)
 
 select p.* from
   (parent p left join child c on (p.k = c.k)) join parent x on p.k = x.k
diff --git a/src/test/regress/expected/join_gp.out 
b/src/test/regress/expected/join_gp.out
index 1a7c1c7e291..e9317d8e277 100644
--- a/src/test/regress/expected/join_gp.out
+++ b/src/test/regress/expected/join_gp.out
@@ -341,21 +341,12 @@ create table bar (c int, d int) distributed randomly;
 insert into foo select generate_series(1,10);
 insert into bar select generate_series(1,10);
 explain select a from foo where a<1 and a>1 and not exists (select c from bar 
where c=a);
-                                               QUERY PLAN                      
                         
---------------------------------------------------------------------------------------------------------
- Gather Motion 3:1  (slice1; segments: 3)  (cost=473.83..1458.05 rows=430 
width=4)
-   ->  Hash Right Anti Join  (cost=473.83..1452.31 rows=144 width=4)
-         Hash Cond: (bar.c = foo.a)
-         ->  Redistribute Motion 3:3  (slice2; segments: 3)  
(cost=0.00..895.00 rows=28700 width=4)
-               Hash Key: bar.c
-               ->  Seq Scan on bar  (cost=0.00..321.00 rows=28700 width=4)
-         ->  Hash  (cost=470.24..470.24 rows=287 width=4)
-               ->  Redistribute Motion 3:3  (slice3; segments: 3)  
(cost=0.00..470.24 rows=287 width=4)
-                     Hash Key: foo.a
-                     ->  Seq Scan on foo  (cost=0.00..464.50 rows=287 width=4)
-                           Filter: ((a < 1) AND (a > 1))
+                QUERY PLAN                
+------------------------------------------
+ Result  (cost=0.00..0.00 rows=0 width=4)
+   One-Time Filter: false
  Optimizer: Postgres query optimizer
-(12 rows)
+(3 rows)
 
 select a from foo where a<1 and a>1 and not exists (select c from bar where 
c=a);
  a 
diff --git a/src/test/regress/expected/partition_pruning.out 
b/src/test/regress/expected/partition_pruning.out
index 38ed06f443a..f4e0478ac7d 100644
--- a/src/test/regress/expected/partition_pruning.out
+++ b/src/test/regress/expected/partition_pruning.out
@@ -1102,8 +1102,7 @@ EXPLAIN SELECT * FROM pt_lt_tab WHERE col2 between 1 AND 
50 ORDER BY col2,col3 L
                ->  Incremental Sort  (cost=122.27..2022.42 rows=17 width=12)
                      Sort Key: pt_lt_tab.col2, pt_lt_tab.col3
                      Presorted Key: pt_lt_tab.col2
-                     ->  Merge Append  (cost=0.73..2021.68 rows=17 width=12)
-                           Sort Key: pt_lt_tab.col2
+                     ->  Append  (cost=0.68..2021.42 rows=17 width=12)
                            ->  Index Scan using idx1 on pt_lt_tab_1_prt_part1 
pt_lt_tab_1  (cost=0.14..404.27 rows=3 width=12)
                                  Index Cond: ((col2 >= '1'::numeric) AND (col2 
<= '50'::numeric))
                            ->  Index Scan using idx2 on pt_lt_tab_1_prt_part2 
pt_lt_tab_2  (cost=0.14..404.27 rows=3 width=12)
@@ -1137,8 +1136,7 @@ EXPLAIN SELECT * FROM pt_lt_tab WHERE col2 > 5 ORDER BY 
col2,col3 LIMIT 5;
                ->  Incremental Sort  (cost=123.40..1862.16 rows=15 width=12)
                      Sort Key: pt_lt_tab.col2, pt_lt_tab.col3
                      Presorted Key: pt_lt_tab.col2
-                     ->  Merge Append  (cost=0.73..1861.48 rows=15 width=12)
-                           Sort Key: pt_lt_tab.col2
+                     ->  Append  (cost=0.68..1861.25 rows=15 width=12)
                            ->  Index Scan using idx1 on pt_lt_tab_1_prt_part1 
pt_lt_tab_1  (cost=0.14..244.20 rows=2 width=12)
                                  Index Cond: (col2 > '5'::numeric)
                            ->  Index Scan using idx2 on pt_lt_tab_1_prt_part2 
pt_lt_tab_2  (cost=0.14..404.24 rows=3 width=12)
@@ -3400,29 +3398,36 @@ SELECT * FROM pt_bool_tab_df WHERE col2 IS unknown;
 (1 row)
 
 EXPLAIN SELECT * FROM pt_bool_tab_df WHERE col2 IS NOT true;
-                                                      QUERY PLAN               
                                        
------------------------------------------------------------------------------------------------------------------------
- Gather Motion 3:1  (slice1; segments: 3)  
(cost=10000000000.00..10000000969.00 rows=46750 width=5)
-   ->  Seq Scan on pt_bool_tab_df_1_prt_part2 pt_bool_tab_df  
(cost=10000000000.00..10000000345.67 rows=15583 width=5)
-         Filter: (col2 IS NOT TRUE)
+                                                          QUERY PLAN           
                                                
+-------------------------------------------------------------------------------------------------------------------------------
+ Gather Motion 3:1  (slice1; segments: 3)  
(cost=10000000000.00..20000002093.83 rows=93500 width=5)
+   ->  Append  (cost=10000000000.00..20000000847.17 rows=31167 width=5)
+         ->  Seq Scan on pt_bool_tab_df_1_prt_part2 pt_bool_tab_df_1  
(cost=10000000000.00..10000000345.67 rows=15583 width=5)
+               Filter: (col2 IS NOT TRUE)
+         ->  Seq Scan on pt_bool_tab_df_1_prt_def pt_bool_tab_df_2  
(cost=10000000000.00..10000000345.67 rows=15583 width=5)
+               Filter: (col2 IS NOT TRUE)
  Optimizer: Postgres query optimizer
-(4 rows)
+(7 rows)
 
 SELECT * FROM pt_bool_tab_df WHERE col2 IS NOT true;
  col1 | col2 
 ------+------
     2 | f
     1 | f
-(2 rows)
+    1 | 
+(3 rows)
 
 EXPLAIN SELECT * FROM pt_bool_tab_df WHERE col2 IS NOT false;
-                                                      QUERY PLAN               
                                        
------------------------------------------------------------------------------------------------------------------------
- Gather Motion 3:1  (slice1; segments: 3)  
(cost=10000000000.00..10000000969.00 rows=46750 width=5)
-   ->  Seq Scan on pt_bool_tab_df_1_prt_part1 pt_bool_tab_df  
(cost=10000000000.00..10000000345.67 rows=15583 width=5)
-         Filter: (col2 IS NOT FALSE)
+                                                          QUERY PLAN           
                                                
+-------------------------------------------------------------------------------------------------------------------------------
+ Gather Motion 3:1  (slice1; segments: 3)  
(cost=10000000000.00..20000002093.83 rows=93500 width=5)
+   ->  Append  (cost=10000000000.00..20000000847.17 rows=31167 width=5)
+         ->  Seq Scan on pt_bool_tab_df_1_prt_part1 pt_bool_tab_df_1  
(cost=10000000000.00..10000000345.67 rows=15583 width=5)
+               Filter: (col2 IS NOT FALSE)
+         ->  Seq Scan on pt_bool_tab_df_1_prt_def pt_bool_tab_df_2  
(cost=10000000000.00..10000000345.67 rows=15583 width=5)
+               Filter: (col2 IS NOT FALSE)
  Optimizer: Postgres query optimizer
-(4 rows)
+(7 rows)
 
 SELECT * FROM pt_bool_tab_df WHERE col2 IS NOT false;
  col1 | col2 
@@ -3430,7 +3435,8 @@ SELECT * FROM pt_bool_tab_df WHERE col2 IS NOT false;
     2 | t
     3 | t
     1 | t
-(3 rows)
+    1 | 
+(4 rows)
 
 EXPLAIN SELECT * FROM pt_bool_tab_df WHERE col2 IS NOT unknown;
                                                           QUERY PLAN           
                                                
@@ -3740,29 +3746,36 @@ SELECT * FROM pt_bool_tab_null WHERE col2 IS unknown;
 (1 row)
 
 EXPLAIN SELECT * FROM pt_bool_tab_null WHERE col2 IS NOT true;
-                                                        QUERY PLAN             
                                            
----------------------------------------------------------------------------------------------------------------------------
- Gather Motion 3:1  (slice1; segments: 3)  
(cost=10000000000.00..10000000969.00 rows=46750 width=5)
-   ->  Seq Scan on pt_bool_tab_null_1_prt_part2 pt_bool_tab_null  
(cost=10000000000.00..10000000345.67 rows=15583 width=5)
-         Filter: (col2 IS NOT TRUE)
+                                                            QUERY PLAN         
                                                    
+-----------------------------------------------------------------------------------------------------------------------------------
+ Gather Motion 3:1  (slice1; segments: 3)  
(cost=10000000000.00..20000002093.83 rows=93500 width=5)
+   ->  Append  (cost=10000000000.00..20000000847.17 rows=31167 width=5)
+         ->  Seq Scan on pt_bool_tab_null_1_prt_part2 pt_bool_tab_null_1  
(cost=10000000000.00..10000000345.67 rows=15583 width=5)
+               Filter: (col2 IS NOT TRUE)
+         ->  Seq Scan on pt_bool_tab_null_1_prt_part3 pt_bool_tab_null_2  
(cost=10000000000.00..10000000345.67 rows=15583 width=5)
+               Filter: (col2 IS NOT TRUE)
  Optimizer: Postgres query optimizer
-(4 rows)
+(7 rows)
 
 SELECT * FROM pt_bool_tab_null WHERE col2 IS NOT true;
  col1 | col2 
 ------+------
-    1 | f
     2 | f
-(2 rows)
+    1 | f
+    1 | 
+(3 rows)
 
 EXPLAIN SELECT * FROM pt_bool_tab_null WHERE col2 IS NOT false;
-                                                        QUERY PLAN             
                                            
----------------------------------------------------------------------------------------------------------------------------
- Gather Motion 3:1  (slice1; segments: 3)  
(cost=10000000000.00..10000000969.00 rows=46750 width=5)
-   ->  Seq Scan on pt_bool_tab_null_1_prt_part1 pt_bool_tab_null  
(cost=10000000000.00..10000000345.67 rows=15583 width=5)
-         Filter: (col2 IS NOT FALSE)
+                                                            QUERY PLAN         
                                                    
+-----------------------------------------------------------------------------------------------------------------------------------
+ Gather Motion 3:1  (slice1; segments: 3)  
(cost=10000000000.00..20000002093.83 rows=93500 width=5)
+   ->  Append  (cost=10000000000.00..20000000847.17 rows=31167 width=5)
+         ->  Seq Scan on pt_bool_tab_null_1_prt_part1 pt_bool_tab_null_1  
(cost=10000000000.00..10000000345.67 rows=15583 width=5)
+               Filter: (col2 IS NOT FALSE)
+         ->  Seq Scan on pt_bool_tab_null_1_prt_part3 pt_bool_tab_null_2  
(cost=10000000000.00..10000000345.67 rows=15583 width=5)
+               Filter: (col2 IS NOT FALSE)
  Optimizer: Postgres query optimizer
-(4 rows)
+(7 rows)
 
 SELECT * FROM pt_bool_tab_null WHERE col2 IS NOT false;
  col1 | col2 
@@ -3770,7 +3783,8 @@ SELECT * FROM pt_bool_tab_null WHERE col2 IS NOT false;
     2 | t
     3 | t
     1 | t
-(3 rows)
+    1 | 
+(4 rows)
 
 EXPLAIN SELECT * FROM pt_bool_tab_null WHERE col2 IS NOT unknown;
                                                             QUERY PLAN         
                                                    
diff --git a/src/test/regress/expected/subselect_gp.out 
b/src/test/regress/expected/subselect_gp.out
index 5866e01393f..3e4ea0d16c9 100644
--- a/src/test/regress/expected/subselect_gp.out
+++ b/src/test/regress/expected/subselect_gp.out
@@ -1132,40 +1132,20 @@ select * from t1 where a=1 and a=2 and a > (select t2.b 
from t2);
 (0 rows)
 
 explain select * from t1 where a=1 and a=2 and a > (select t2.b from t2);
-                                        QUERY PLAN                             
            
--------------------------------------------------------------------------------------------
- Gather Motion 1:1  (slice1; segments: 1)  (cost=1639.00..2154.52 rows=1 
width=4)
-   InitPlan 1 (returns $0)  (slice2)
-     ->  Gather Motion 3:1  (slice3; segments: 3)  (cost=0.00..1639.00 
rows=96300 width=4)
-           ->  Seq Scan on t2  (cost=0.00..355.00 rows=32100 width=4)
-   ->  Result  (cost=0.00..515.50 rows=1 width=4)
-         One-Time Filter: false
-         ->  Seq Scan on t1  (cost=0.00..515.50 rows=1 width=4)
-               Filter: ((a > $0) AND (a = 1))
+                   QUERY PLAN                   
+------------------------------------------------
+ Result  (cost=1639.00..1639.00 rows=0 width=0)
+   One-Time Filter: false
  Optimizer: Postgres query optimizer
-(9 rows)
+(3 rows)
 
 explain select * from t1 where a=1 and a=2 and a > (select t2.b from t2)
 union all
 select * from t1 where a=1 and a=2 and a > (select t2.b from t2);
-                                              QUERY PLAN                       
                        
--------------------------------------------------------------------------------------------------------
- Gather Motion 1:1  (slice1; segments: 1)  (cost=1639.00..4309.09 rows=6 
width=4)
-   ->  Append  (cost=1639.00..4309.01 rows=2 width=4)
-         ->  Result  (cost=1639.00..2154.50 rows=1 width=4)
-               One-Time Filter: false
-               InitPlan 1 (returns $0)  (slice2)
-                 ->  Gather Motion 3:1  (slice3; segments: 3)  
(cost=0.00..1639.00 rows=96300 width=4)
-                       ->  Seq Scan on t2  (cost=0.00..355.00 rows=32100 
width=4)
-               ->  Seq Scan on t1  (cost=1639.00..2154.50 rows=1 width=4)
-                     Filter: ((a > $0) AND (a = 1))
-         ->  Result  (cost=1639.00..2154.50 rows=1 width=4)
-               One-Time Filter: false
-               InitPlan 2 (returns $1)  (slice4)
-                 ->  Gather Motion 3:1  (slice5; segments: 3)  
(cost=0.00..1639.00 rows=96300 width=4)
-                       ->  Seq Scan on t2 t2_1  (cost=0.00..355.00 rows=32100 
width=4)
-               ->  Seq Scan on t1 t1_1  (cost=1639.00..2154.50 rows=1 width=4)
-                     Filter: ((a > $1) AND (a = 1))
+                QUERY PLAN                
+------------------------------------------
+ Result  (cost=0.00..0.00 rows=0 width=0)
+   One-Time Filter: false
  Optimizer: Postgres query optimizer
 (3 rows)
 
diff --git a/src/test/regress/expected/update_gp.out 
b/src/test/regress/expected/update_gp.out
index 8694dcaa101..2dc6986a891 100644
--- a/src/test/regress/expected/update_gp.out
+++ b/src/test/regress/expected/update_gp.out
@@ -672,15 +672,13 @@ select * from s;
 -- constraints in the planner.
 create table nosplitupdate (a int) distributed by (a);
 explain update nosplitupdate set a=0 where a=1 and a<1;
-                                             QUERY PLAN                        
                      
------------------------------------------------------------------------------------------------------
- Update on nosplitupdate  (cost=0.00..516.24 rows=0 width=0)
-   ->  Explicit Redistribute Motion 1:3  (slice1; segments: 1)  
(cost=0.00..516.24 rows=37 width=14)
-         ->  Split Update  (cost=0.00..515.50 rows=37 width=14)
-               ->  Seq Scan on nosplitupdate  (cost=0.00..515.50 rows=19 
width=14)
-                     Filter: ((a < 1) AND (a = 1))
+                        QUERY PLAN                         
+-----------------------------------------------------------
+ Update on nosplitupdate  (cost=0.00..0.01 rows=0 width=0)
+   ->  Result  (cost=0.00..0.00 rows=0 width=14)
+         One-Time Filter: false
  Optimizer: Postgres query optimizer
-(6 rows)
+(4 rows)
 
 -- test split-update when split-node's flow is entry
 create table tsplit_entry (c int);


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

Reply via email to