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 f574a170ede Fix some answer files for parallel schedule in pax
f574a170ede is described below

commit f574a170ede80f60fc2b66ab56c847cd4a22c754
Author: Jinbao Chen <[email protected]>
AuthorDate: Mon Mar 16 20:44:45 2026 -0400

    Fix some answer files for parallel schedule in pax
---
 .../src/test/regress/expected/alter_table.out      |   3 +-
 .../src/test/regress/expected/bitmapops.out        |  40 +-
 .../src/test/regress/expected/copy2.out            |   2 +
 .../src/test/regress/expected/dependency.out       |   4 +
 .../src/test/regress/expected/domain.out           |   2 +-
 .../src/test/regress/expected/explain.out          |  10 +-
 .../pax_storage/src/test/regress/expected/json.out |  11 +-
 .../src/test/regress/expected/limit.out            |  24 +-
 .../src/test/regress/expected/oidjoins.out         |   2 +
 .../test/regress/expected/partition_aggregate.out  |  25 +-
 .../src/test/regress/expected/partition_join.out   | 458 +++++++++++----------
 .../src/test/regress/expected/partition_prune.out  |  32 +-
 .../src/test/regress/expected/polymorphism.out     |   8 +-
 .../src/test/regress/expected/prepare.out          |   2 +-
 .../src/test/regress/expected/rangefuncs.out       |  34 +-
 .../src/test/regress/expected/sequence.out         |   3 +-
 .../src/test/regress/expected/stats.out            |   2 +-
 .../src/test/regress/expected/subscription.out     |  96 ++---
 .../src/test/regress/expected/tsearch.out          |  18 +-
 .../src/test/regress/expected/tuplesort.out        |  56 +--
 .../src/test/regress/expected/window.out           |  79 ++--
 21 files changed, 467 insertions(+), 444 deletions(-)

diff --git a/contrib/pax_storage/src/test/regress/expected/alter_table.out 
b/contrib/pax_storage/src/test/regress/expected/alter_table.out
index fdc79c03c82..d4c49099a4a 100644
--- a/contrib/pax_storage/src/test/regress/expected/alter_table.out
+++ b/contrib/pax_storage/src/test/regress/expected/alter_table.out
@@ -124,7 +124,8 @@ DROP TABLE attmp;
 -- fails with incorrect object type
 CREATE VIEW at_v1 AS SELECT 1 as a;
 ALTER TABLE at_v1 ALTER COLUMN a SET STATISTICS 0;
-ERROR:  "at_v1" is not a table, materialized view, index, partitioned index, 
or foreign table
+ERROR:  ALTER action ALTER COLUMN ... SET STATISTICS cannot be performed on 
relation "at_v1"
+DETAIL:  This operation is not supported for views.
 DROP VIEW at_v1;
 --
 -- rename - check on both non-temp and temp tables
diff --git a/contrib/pax_storage/src/test/regress/expected/bitmapops.out 
b/contrib/pax_storage/src/test/regress/expected/bitmapops.out
index d6428387e0e..a3d5147b372 100644
--- a/contrib/pax_storage/src/test/regress/expected/bitmapops.out
+++ b/contrib/pax_storage/src/test/regress/expected/bitmapops.out
@@ -149,18 +149,18 @@ SELECT count(*) FROM bmscantest_ao WHERE a = 1 AND b = 1 
AND c = 1;
 EXPLAIN SELECT count(*) FROM bmscantest_ao WHERE a = 1 AND (b = 1 OR c = 1) 
AND d = 1;
                                                  QUERY PLAN                    
                              
 
-------------------------------------------------------------------------------------------------------------
- Finalize Aggregate  (cost=74.60..74.61 rows=1 width=8)
-   ->  Gather Motion 3:1  (slice1; segments: 3)  (cost=74.54..74.59 rows=3 
width=8)
-         ->  Partial Aggregate  (cost=74.54..74.55 rows=1 width=8)
-               ->  Bitmap Heap Scan on bmscantest_ao  (cost=70.47..74.49 
rows=18 width=0)
-                     Recheck Cond: ((d = 1) AND (a = 1) AND ((b = 1) OR (c = 
1)))
-                     ->  BitmapAnd  (cost=70.47..70.47 rows=1 width=0)
+ Finalize Aggregate  (cost=47.80..47.81 rows=1 width=8)
+   ->  Gather Motion 3:1  (slice1; segments: 3)  (cost=47.74..47.79 rows=3 
width=8)
+         ->  Partial Aggregate  (cost=47.74..47.75 rows=1 width=8)
+               ->  Bitmap Heap Scan on bmscantest_ao  (cost=43.68..47.70 
rows=18 width=0)
+                     Recheck Cond: ((a = 1) AND (d = 1) AND ((b = 1) OR (c = 
1)))
+                     ->  BitmapAnd  (cost=43.68..43.68 rows=1 width=0)
+                           ->  Bitmap Index Scan on i_bmtest_ao_a  
(cost=0.00..4.01 rows=440 width=0)
+                                 Index Cond: (a = 1)
                            ->  Bitmap Index Scan on i_bmtest_ao_d  
(cost=0.00..17.07 rows=396 width=0)
                                  Index Cond: (d = 1)
-                           ->  Bitmap Index Scan on i_bmtest_ao_a  
(cost=0.00..17.91 rows=440 width=0)
-                                 Index Cond: (a = 1)
-                           ->  BitmapOr  (cost=34.99..34.99 rows=836 width=0)
-                                 ->  Bitmap Index Scan on i_bmtest_ao_b  
(cost=0.00..16.90 rows=396 width=0)
+                           ->  BitmapOr  (cost=22.09..22.09 rows=836 width=0)
+                                 ->  Bitmap Index Scan on i_bmtest_ao_b  
(cost=0.00..4.01 rows=396 width=0)
                                        Index Cond: (b = 1)
                                  ->  Bitmap Index Scan on i_bmtest_ao_c  
(cost=0.00..18.07 rows=440 width=0)
                                        Index Cond: (c = 1)
@@ -263,18 +263,18 @@ SELECT count(*) FROM bmscantest_aocs WHERE a = 1 AND b = 
1 AND c = 1;
 EXPLAIN SELECT count(*) FROM bmscantest_aocs WHERE a = 1 AND (b = 1 OR c = 1) 
AND d = 1;
                                                   QUERY PLAN                   
                                
 
---------------------------------------------------------------------------------------------------------------
- Finalize Aggregate  (cost=74.60..74.61 rows=1 width=8)
-   ->  Gather Motion 3:1  (slice1; segments: 3)  (cost=74.54..74.59 rows=3 
width=8)
-         ->  Partial Aggregate  (cost=74.54..74.55 rows=1 width=8)
-               ->  Bitmap Heap Scan on bmscantest_aocs  (cost=70.47..74.49 
rows=18 width=0)
-                     Recheck Cond: ((d = 1) AND (a = 1) AND ((b = 1) OR (c = 
1)))
-                     ->  BitmapAnd  (cost=70.47..70.47 rows=1 width=0)
+ Finalize Aggregate  (cost=47.80..47.81 rows=1 width=8)
+   ->  Gather Motion 3:1  (slice1; segments: 3)  (cost=47.74..47.79 rows=3 
width=8)
+         ->  Partial Aggregate  (cost=47.74..47.75 rows=1 width=8)
+               ->  Bitmap Heap Scan on bmscantest_aocs  (cost=43.68..47.70 
rows=18 width=0)
+                     Recheck Cond: ((a = 1) AND (d = 1) AND ((b = 1) OR (c = 
1)))
+                     ->  BitmapAnd  (cost=43.68..43.68 rows=1 width=0)
+                           ->  Bitmap Index Scan on i_bmtest_aocs_a  
(cost=0.00..4.01 rows=440 width=0)
+                                 Index Cond: (a = 1)
                            ->  Bitmap Index Scan on i_bmtest_aocs_d  
(cost=0.00..17.07 rows=396 width=0)
                                  Index Cond: (d = 1)
-                           ->  Bitmap Index Scan on i_bmtest_aocs_a  
(cost=0.00..17.91 rows=440 width=0)
-                                 Index Cond: (a = 1)
-                           ->  BitmapOr  (cost=34.99..34.99 rows=836 width=0)
-                                 ->  Bitmap Index Scan on i_bmtest_aocs_b  
(cost=0.00..16.90 rows=396 width=0)
+                           ->  BitmapOr  (cost=22.09..22.09 rows=836 width=0)
+                                 ->  Bitmap Index Scan on i_bmtest_aocs_b  
(cost=0.00..4.01 rows=396 width=0)
                                        Index Cond: (b = 1)
                                  ->  Bitmap Index Scan on i_bmtest_aocs_c  
(cost=0.00..18.07 rows=440 width=0)
                                        Index Cond: (c = 1)
diff --git a/contrib/pax_storage/src/test/regress/expected/copy2.out 
b/contrib/pax_storage/src/test/regress/expected/copy2.out
index 7b2cd8302af..5342f294087 100644
--- a/contrib/pax_storage/src/test/regress/expected/copy2.out
+++ b/contrib/pax_storage/src/test/regress/expected/copy2.out
@@ -77,6 +77,8 @@ LINE 1: COPY x from stdin (force_not_null (a), force_not_null 
(b));
                                                ^
 COPY x from stdin (force_null (a), force_null (b));
 ERROR:  conflicting or redundant options
+LINE 1: COPY x from stdin (force_null (a), force_null (b));
+                                           ^
 COPY x from stdin (convert_selectively (a), convert_selectively (b));
 ERROR:  conflicting or redundant options
 LINE 1: COPY x from stdin (convert_selectively (a), convert_selectiv...
diff --git a/contrib/pax_storage/src/test/regress/expected/dependency.out 
b/contrib/pax_storage/src/test/regress/expected/dependency.out
index 3d3fec72599..3564de89222 100644
--- a/contrib/pax_storage/src/test/regress/expected/dependency.out
+++ b/contrib/pax_storage/src/test/regress/expected/dependency.out
@@ -49,12 +49,16 @@ SET SESSION AUTHORIZATION regress_dep_user0;
 -- permission denied
 DROP OWNED BY regress_dep_user1;
 ERROR:  permission denied to drop objects
+DETAIL:  Only roles with privileges of role "regress_dep_user1" may drop 
objects owned by it.
 DROP OWNED BY regress_dep_user0, regress_dep_user2;
 ERROR:  permission denied to drop objects
+DETAIL:  Only roles with privileges of role "regress_dep_user2" may drop 
objects owned by it.
 REASSIGN OWNED BY regress_dep_user0 TO regress_dep_user1;
 ERROR:  permission denied to reassign objects
+DETAIL:  Only roles with privileges of role "regress_dep_user1" may reassign 
objects to it.
 REASSIGN OWNED BY regress_dep_user1 TO regress_dep_user0;
 ERROR:  permission denied to reassign objects
+DETAIL:  Only roles with privileges of role "regress_dep_user1" may reassign 
objects owned by it.
 -- this one is allowed
 DROP OWNED BY regress_dep_user0;
 CREATE TABLE deptest1 (f1 int unique) DISTRIBUTED BY (f1);
diff --git a/contrib/pax_storage/src/test/regress/expected/domain.out 
b/contrib/pax_storage/src/test/regress/expected/domain.out
index c83c60f445b..e4d4f74ae6a 100644
--- a/contrib/pax_storage/src/test/regress/expected/domain.out
+++ b/contrib/pax_storage/src/test/regress/expected/domain.out
@@ -426,7 +426,7 @@ explain (verbose, costs off)
  Update on public.dcomptable
    ->  Explicit Redistribute Motion 3:3  (slice1; segments: 3)
          Output: (((d1[1].r := (d1[1].r - '1'::double precision))[1].i := 
(d1[1].i + '1'::double precision))::dcomptypea), ctid, gp_segment_id, 
dcomptable.*, (DMLAction)
-         ->  Split
+         ->  Split Update
                Output: (((d1[1].r := (d1[1].r - '1'::double precision))[1].i 
:= (d1[1].i + '1'::double precision))::dcomptypea), ctid, gp_segment_id, 
dcomptable.*, DMLAction
                ->  Seq Scan on public.dcomptable
                      Output: (d1[1].r := (d1[1].r - '1'::double 
precision))[1].i := (d1[1].i + '1'::double precision), ctid, gp_segment_id, 
dcomptable.*
diff --git a/contrib/pax_storage/src/test/regress/expected/explain.out 
b/contrib/pax_storage/src/test/regress/expected/explain.out
index 0a4e3e527b7..13ca24dd5ff 100644
--- a/contrib/pax_storage/src/test/regress/expected/explain.out
+++ b/contrib/pax_storage/src/test/regress/expected/explain.out
@@ -596,13 +596,6 @@ select jsonb_pretty(
                      "Sort Key": [                          +
                          "tenk1.tenthous"                   +
                      ],                                     +
-                     "work_mem": {                          +
-                         "Used": 0,                         +
-                         "Segments": 0,                     +
-                         "Max Memory": 0,                   +
-                         "Workfile Spilling": 0,            +
-                         "Max Memory Segment": 0            +
-                     },                                     +
                      "Gang Type": "primary reader",         +
                      "Node Type": "Sort",                   +
                      "Plan Rows": 0,                        +
@@ -716,8 +709,7 @@ select jsonb_pretty(
                      "Workers": 0,                          +
                      "Subworkers": 0,                       +
                      "Maximum Memory Used": 0               +
-                 },                                         +
-                 "Work Maximum Memory": 0                   +
+                 }                                          +
              }                                              +
          ],                                                 +
          "Statement statistics": {                          +
diff --git a/contrib/pax_storage/src/test/regress/expected/json.out 
b/contrib/pax_storage/src/test/regress/expected/json.out
index 50e6eccd560..a70c31aea6b 100644
--- a/contrib/pax_storage/src/test/regress/expected/json.out
+++ b/contrib/pax_storage/src/test/regress/expected/json.out
@@ -2087,8 +2087,7 @@ SELECT json_build_object('a', 'b', 'c'); -- error
 ERROR:  argument list must have even number of elements
 HINT:  The arguments of json_build_object() must consist of alternating keys 
and values.
 SELECT json_build_object(NULL, 'a'); -- error, key cannot be NULL
-ERROR:  argument 1 cannot be null
-HINT:  Object keys should be text.
+ERROR:  null value not allowed for object key
 SELECT json_build_object('a', NULL); -- ok
  json_build_object 
 -------------------
@@ -2117,8 +2116,7 @@ SELECT json_build_object(VARIADIC ARRAY['a', 
NULL]::text[]); -- ok
 (1 row)
 
 SELECT json_build_object(VARIADIC ARRAY[NULL, 'a']::text[]); -- error, key 
cannot be NULL
-ERROR:  argument 1 cannot be null
-HINT:  Object keys should be text.
+ERROR:  null value not allowed for object key
 SELECT json_build_object(VARIADIC '{1,2,3,4}'::text[]); -- ok
    json_build_object    
 ------------------------
@@ -2159,8 +2157,7 @@ SELECT json_build_object(1,2);
 
 -- keys must be scalar and not null
 SELECT json_build_object(null,2);
-ERROR:  argument 1 cannot be null
-HINT:  Object keys should be text.
+ERROR:  null value not allowed for object key
 SELECT json_build_object(r,2) FROM (SELECT 1 AS a, 2 AS b) r;
 ERROR:  key value must be scalar, not array, composite, or json
 SELECT json_build_object(json '{"a":1,"b":2}', 3);
@@ -2186,7 +2183,7 @@ SELECT json_object_agg(name, type order by type, name) 
FROM foo;
 
 INSERT INTO foo VALUES (999999, NULL, 'bar');
 SELECT json_object_agg(name, type) FROM foo;
-ERROR:  field name must not be null
+ERROR:  null value not allowed for object key
 -- json_object
 -- empty object, one dimension
 SELECT json_object('{}');
diff --git a/contrib/pax_storage/src/test/regress/expected/limit.out 
b/contrib/pax_storage/src/test/regress/expected/limit.out
index 4b6e5e1f0a6..7773d8c0429 100644
--- a/contrib/pax_storage/src/test/regress/expected/limit.out
+++ b/contrib/pax_storage/src/test/regress/expected/limit.out
@@ -627,10 +627,10 @@ CREATE VIEW limit_thousand_v_1 AS SELECT thousand FROM 
onek WHERE thousand < 995
 ----------+---------+-----------+----------+---------+---------+-------------
  thousand | integer |           |          |         | plain   | 
 View definition:
- SELECT onek.thousand
+ SELECT thousand
    FROM onek
-  WHERE onek.thousand < 995
-  ORDER BY onek.thousand
+  WHERE thousand < 995
+  ORDER BY thousand
  OFFSET 10
  FETCH FIRST 5 ROWS WITH TIES;
 
@@ -642,10 +642,10 @@ CREATE VIEW limit_thousand_v_2 AS SELECT thousand FROM 
onek WHERE thousand < 995
 ----------+---------+-----------+----------+---------+---------+-------------
  thousand | integer |           |          |         | plain   | 
 View definition:
- SELECT onek.thousand
+ SELECT thousand
    FROM onek
-  WHERE onek.thousand < 995
-  ORDER BY onek.thousand
+  WHERE thousand < 995
+  ORDER BY thousand
  OFFSET 10
  LIMIT 5;
 
@@ -660,10 +660,10 @@ CREATE VIEW limit_thousand_v_3 AS SELECT thousand FROM 
onek WHERE thousand < 995
 ----------+---------+-----------+----------+---------+---------+-------------
  thousand | integer |           |          |         | plain   | 
 View definition:
- SELECT onek.thousand
+ SELECT thousand
    FROM onek
-  WHERE onek.thousand < 995
-  ORDER BY onek.thousand
+  WHERE thousand < 995
+  ORDER BY thousand
  FETCH FIRST (NULL::integer + 1) ROWS WITH TIES;
 
 CREATE VIEW limit_thousand_v_4 AS SELECT thousand FROM onek WHERE thousand < 
995
@@ -674,10 +674,10 @@ CREATE VIEW limit_thousand_v_4 AS SELECT thousand FROM 
onek WHERE thousand < 995
 ----------+---------+-----------+----------+---------+---------+-------------
  thousand | integer |           |          |         | plain   | 
 View definition:
- SELECT onek.thousand
+ SELECT thousand
    FROM onek
-  WHERE onek.thousand < 995
-  ORDER BY onek.thousand
+  WHERE thousand < 995
+  ORDER BY thousand
  LIMIT ALL;
 
 -- leave these views
diff --git a/contrib/pax_storage/src/test/regress/expected/oidjoins.out 
b/contrib/pax_storage/src/test/regress/expected/oidjoins.out
index f739326012d..19094e111dc 100644
--- a/contrib/pax_storage/src/test/regress/expected/oidjoins.out
+++ b/contrib/pax_storage/src/test/regress/expected/oidjoins.out
@@ -275,6 +275,8 @@ NOTICE:  checking pg_transform {trftosql} => pg_proc {oid}
 NOTICE:  checking pg_sequence {seqrelid} => pg_class {oid}
 NOTICE:  checking pg_sequence {seqtypid} => pg_type {oid}
 NOTICE:  checking pg_publication {pubowner} => pg_authid {oid}
+NOTICE:  checking pg_publication_namespace {pnpubid} => pg_publication {oid}
+NOTICE:  checking pg_publication_namespace {pnnspid} => pg_namespace {oid}
 NOTICE:  checking pg_publication_rel {prpubid} => pg_publication {oid}
 NOTICE:  checking pg_publication_rel {prrelid} => pg_class {oid}
 NOTICE:  checking pg_subscription {subdbid} => pg_database {oid}
diff --git 
a/contrib/pax_storage/src/test/regress/expected/partition_aggregate.out 
b/contrib/pax_storage/src/test/regress/expected/partition_aggregate.out
index 65381d04800..61c45805304 100644
--- a/contrib/pax_storage/src/test/regress/expected/partition_aggregate.out
+++ b/contrib/pax_storage/src/test/regress/expected/partition_aggregate.out
@@ -192,7 +192,6 @@ SELECT c, sum(a) FROM pagg_tab WHERE c = 'x' GROUP BY c;
            QUERY PLAN           
 --------------------------------
  GroupAggregate
-   Group Key: c
    ->  Result
          One-Time Filter: false
 (4 rows)
@@ -436,21 +435,21 @@ SELECT c, sum(b order by a) FROM pagg_tab GROUP BY c 
ORDER BY 1, 2;
                ->  GroupAggregate
                      Group Key: pagg_tab.c
                      ->  Sort
-                           Sort Key: pagg_tab.c
+                           Sort Key: pagg_tab.c, pagg_tab.a
                            ->  Redistribute Motion 3:3  (slice2; segments: 3)
                                  Hash Key: pagg_tab.c
                                  ->  Seq Scan on pagg_tab_p1 pagg_tab
                ->  GroupAggregate
                      Group Key: pagg_tab_1.c
                      ->  Sort
-                           Sort Key: pagg_tab_1.c
+                           Sort Key: pagg_tab_1.c, pagg_tab_1.a
                            ->  Redistribute Motion 3:3  (slice3; segments: 3)
                                  Hash Key: pagg_tab_1.c
                                  ->  Seq Scan on pagg_tab_p2 pagg_tab_1
                ->  GroupAggregate
                      Group Key: pagg_tab_2.c
                      ->  Sort
-                           Sort Key: pagg_tab_2.c
+                           Sort Key: pagg_tab_2.c, pagg_tab_2.a
                            ->  Redistribute Motion 3:3  (slice4; segments: 3)
                                  Hash Key: pagg_tab_2.c
                                  ->  Seq Scan on pagg_tab_p3 pagg_tab_2
@@ -962,10 +961,10 @@ SELECT a.x, b.y, count(*) FROM (SELECT * FROM pagg_tab1 
WHERE x < 20) a FULL JOI
 -- Empty join relation because of empty outer side, no partitionwise agg plan
 EXPLAIN (COSTS OFF)
 SELECT a.x, a.y, count(*) FROM (SELECT * FROM pagg_tab1 WHERE x = 1 AND x = 2) 
a LEFT JOIN pagg_tab2 b ON a.x = b.y GROUP BY a.x, a.y ORDER BY 1, 2;
-              QUERY PLAN               
----------------------------------------
+              QUERY PLAN              
+--------------------------------------
  GroupAggregate
-   Group Key: pagg_tab1.x, pagg_tab1.y
+   Group Key: pagg_tab1.y
    ->  Sort
          Sort Key: pagg_tab1.y
          ->  Result
@@ -1127,13 +1126,13 @@ SELECT a, sum(b), array_agg(distinct c), count(*) FROM 
pagg_tab_ml GROUP BY a HA
                      Group Key: pagg_tab_ml.a
                      Filter: (avg(pagg_tab_ml.b) < '3'::numeric)
                      ->  Sort
-                           Sort Key: pagg_tab_ml.a
+                           Sort Key: pagg_tab_ml.a, pagg_tab_ml.c
                            ->  Seq Scan on pagg_tab_ml_p1 pagg_tab_ml
                ->  GroupAggregate
                      Group Key: pagg_tab_ml_2.a
                      Filter: (avg(pagg_tab_ml_2.b) < '3'::numeric)
                      ->  Sort
-                           Sort Key: pagg_tab_ml_2.a
+                           Sort Key: pagg_tab_ml_2.a, pagg_tab_ml_2.c
                            ->  Append
                                  ->  Seq Scan on pagg_tab_ml_p2_s1 
pagg_tab_ml_2
                                  ->  Seq Scan on pagg_tab_ml_p2_s2 
pagg_tab_ml_3
@@ -1141,7 +1140,7 @@ SELECT a, sum(b), array_agg(distinct c), count(*) FROM 
pagg_tab_ml GROUP BY a HA
                      Group Key: pagg_tab_ml_5.a
                      Filter: (avg(pagg_tab_ml_5.b) < '3'::numeric)
                      ->  Sort
-                           Sort Key: pagg_tab_ml_5.a
+                           Sort Key: pagg_tab_ml_5.a, pagg_tab_ml_5.c
                            ->  Append
                                  ->  Seq Scan on pagg_tab_ml_p3_s1 
pagg_tab_ml_5
                                  ->  Seq Scan on pagg_tab_ml_p3_s2 
pagg_tab_ml_6
@@ -1173,13 +1172,13 @@ SELECT a, sum(b), array_agg(distinct c), count(*) FROM 
pagg_tab_ml GROUP BY a HA
                Group Key: pagg_tab_ml.a
                Filter: (avg(pagg_tab_ml.b) < '3'::numeric)
                ->  Sort
-                     Sort Key: pagg_tab_ml.a
+                     Sort Key: pagg_tab_ml.a, pagg_tab_ml.c
                      ->  Seq Scan on pagg_tab_ml_p1 pagg_tab_ml
          ->  GroupAggregate
                Group Key: pagg_tab_ml_2.a
                Filter: (avg(pagg_tab_ml_2.b) < '3'::numeric)
                ->  Sort
-                     Sort Key: pagg_tab_ml_2.a
+                     Sort Key: pagg_tab_ml_2.a, pagg_tab_ml_2.c
                      ->  Append
                            ->  Seq Scan on pagg_tab_ml_p2_s1 pagg_tab_ml_2
                            ->  Seq Scan on pagg_tab_ml_p2_s2 pagg_tab_ml_3
@@ -1187,7 +1186,7 @@ SELECT a, sum(b), array_agg(distinct c), count(*) FROM 
pagg_tab_ml GROUP BY a HA
                Group Key: pagg_tab_ml_5.a
                Filter: (avg(pagg_tab_ml_5.b) < '3'::numeric)
                ->  Sort
-                     Sort Key: pagg_tab_ml_5.a
+                     Sort Key: pagg_tab_ml_5.a, pagg_tab_ml_5.c
                      ->  Append
                            ->  Seq Scan on pagg_tab_ml_p3_s1 pagg_tab_ml_5
                            ->  Seq Scan on pagg_tab_ml_p3_s2 pagg_tab_ml_6
diff --git a/contrib/pax_storage/src/test/regress/expected/partition_join.out 
b/contrib/pax_storage/src/test/regress/expected/partition_join.out
index ec936d30e1c..19b15da7b4a 100644
--- a/contrib/pax_storage/src/test/regress/expected/partition_join.out
+++ b/contrib/pax_storage/src/test/regress/expected/partition_join.out
@@ -508,10 +508,10 @@ SELECT a, b FROM prt1 FULL JOIN prt2 p2(b,a,c) USING(a,b)
 
-----------------------------------------------------------------------------------------------------------------------
  Gather Motion 3:1  (slice1; segments: 3)
    Merge Key: (COALESCE(prt1.a, p2.a)), (COALESCE(prt1.b, p2.b))
-   ->  GroupAggregate
-         Group Key: (COALESCE(prt1.a, p2.a)), (COALESCE(prt1.b, p2.b))
-         ->  Sort
-               Sort Key: (COALESCE(prt1.a, p2.a)), (COALESCE(prt1.b, p2.b))
+   ->  Sort
+         Sort Key: (COALESCE(prt1.a, p2.a)), (COALESCE(prt1.b, p2.b))
+         ->  HashAggregate
+               Group Key: (COALESCE(prt1.a, p2.a)), (COALESCE(prt1.b, p2.b))
                ->  Redistribute Motion 3:3  (slice2; segments: 3)
                      Hash Key: (COALESCE(prt1.a, p2.a)), (COALESCE(prt1.b, 
p2.b))
                      ->  Append
@@ -1000,13 +1000,10 @@ SELECT t1.a, t1.phv, t2.b, t2.phv, t3.a + t3.b, t3.phv 
FROM ((SELECT 50 phv, * F
          Sort Key: prt1.a, prt2.b, ((prt1_e.a + prt1_e.b))
          ->  Append
                ->  Hash Full Join
-                     Hash Cond: (((prt1_e_1.a + prt1_e_1.b) / 2) = prt1_1.a)
+                     Hash Cond: (prt1_1.a = ((prt1_e_1.a + prt1_e_1.b) / 2))
                      Filter: ((prt1_1.a = (50)) OR (prt2_1.b = (75)) OR 
(((prt1_e_1.a + prt1_e_1.b) / 2) = (50)))
                      ->  Redistribute Motion 3:3  (slice2; segments: 3)
-                           Hash Key: ((prt1_e_1.a + prt1_e_1.b) / 2)
-                           ->  Seq Scan on prt1_e_p1 prt1_e_1
-                                 Filter: (c = 0)
-                     ->  Hash
+                           Hash Key: prt1_1.a
                            ->  Hash Full Join
                                  Hash Cond: (prt1_1.a = prt2_1.b)
                                  ->  Seq Scan on prt1_p1 prt1_1
@@ -1016,42 +1013,51 @@ SELECT t1.a, t1.phv, t2.b, t2.phv, t3.a + t3.b, t3.phv 
FROM ((SELECT 50 phv, * F
                                              Hash Key: prt2_1.b
                                              ->  Seq Scan on prt2_p1 prt2_1
                                                    Filter: (a = 0)
+                     ->  Hash
+                           ->  Redistribute Motion 3:3  (slice4; segments: 3)
+                                 Hash Key: ((prt1_e_1.a + prt1_e_1.b) / 2)
+                                 ->  Seq Scan on prt1_e_p1 prt1_e_1
+                                       Filter: (c = 0)
                ->  Hash Full Join
-                     Hash Cond: (((prt1_e_2.a + prt1_e_2.b) / 2) = prt1_2.a)
+                     Hash Cond: (prt1_2.a = ((prt1_e_2.a + prt1_e_2.b) / 2))
                      Filter: ((prt1_2.a = (50)) OR (prt2_2.b = (75)) OR 
(((prt1_e_2.a + prt1_e_2.b) / 2) = (50)))
-                     ->  Redistribute Motion 3:3  (slice4; segments: 3)
-                           Hash Key: ((prt1_e_2.a + prt1_e_2.b) / 2)
-                           ->  Seq Scan on prt1_e_p2 prt1_e_2
-                                 Filter: (c = 0)
-                     ->  Hash
+                     ->  Redistribute Motion 3:3  (slice5; segments: 3)
+                           Hash Key: prt1_2.a
                            ->  Hash Full Join
                                  Hash Cond: (prt1_2.a = prt2_2.b)
                                  ->  Seq Scan on prt1_p2 prt1_2
                                        Filter: (b = 0)
                                  ->  Hash
-                                       ->  Redistribute Motion 1:3  (slice5; 
segments: 1)
+                                       ->  Redistribute Motion 1:3  (slice6; 
segments: 1)
                                              Hash Key: prt2_2.b
                                              ->  Seq Scan on prt2_p2 prt2_2
                                                    Filter: (a = 0)
+                     ->  Hash
+                           ->  Redistribute Motion 3:3  (slice7; segments: 3)
+                                 Hash Key: ((prt1_e_2.a + prt1_e_2.b) / 2)
+                                 ->  Seq Scan on prt1_e_p2 prt1_e_2
+                                       Filter: (c = 0)
                ->  Hash Full Join
                      Hash Cond: (prt1_3.a = ((prt1_e_3.a + prt1_e_3.b) / 2))
                      Filter: ((prt1_3.a = (50)) OR (prt2_3.b = (75)) OR 
(((prt1_e_3.a + prt1_e_3.b) / 2) = (50)))
-                     ->  Hash Full Join
-                           Hash Cond: (prt1_3.a = prt2_3.b)
-                           ->  Seq Scan on prt1_p3 prt1_3
-                                 Filter: (b = 0)
-                           ->  Hash
-                                 ->  Redistribute Motion 1:3  (slice6; 
segments: 1)
-                                       Hash Key: prt2_3.b
-                                       ->  Seq Scan on prt2_p3 prt2_3
-                                             Filter: (a = 0)
+                     ->  Redistribute Motion 3:3  (slice8; segments: 3)
+                           Hash Key: prt1_3.a
+                           ->  Hash Full Join
+                                 Hash Cond: (prt1_3.a = prt2_3.b)
+                                 ->  Seq Scan on prt1_p3 prt1_3
+                                       Filter: (b = 0)
+                                 ->  Hash
+                                       ->  Redistribute Motion 1:3  (slice9; 
segments: 1)
+                                             Hash Key: prt2_3.b
+                                             ->  Seq Scan on prt2_p3 prt2_3
+                                                   Filter: (a = 0)
                      ->  Hash
-                           ->  Redistribute Motion 3:3  (slice7; segments: 3)
+                           ->  Redistribute Motion 3:3  (slice10; segments: 3)
                                  Hash Key: ((prt1_e_3.a + prt1_e_3.b) / 2)
                                  ->  Seq Scan on prt1_e_p3 prt1_e_3
                                        Filter: (c = 0)
  Optimizer: Postgres query optimizer
-(57 rows)
+(63 rows)
 
 SELECT t1.a, t1.phv, t2.b, t2.phv, t3.a + t3.b, t3.phv FROM ((SELECT 50 phv, * 
FROM prt1 WHERE prt1.b = 0) t1 FULL JOIN (SELECT 75 phv, * FROM prt2 WHERE 
prt2.a = 0) t2 ON (t1.a = t2.b)) FULL JOIN (SELECT 50 phv, * FROM prt1_e WHERE 
prt1_e.c = 0) t3 ON (t1.a = (t3.a + t3.b)/2) WHERE t1.a = t1.phv OR t2.b = 
t2.phv OR (t3.a + t3.b)/2 = t3.phv ORDER BY t1.a, t2.b, t3.a + t3.b;
  a  | phv | b  | phv | ?column? | phv 
@@ -1596,11 +1602,11 @@ SELECT avg(t1.a), avg(t2.b), avg(t3.a + t3.b), t1.c, 
t2.c, t3.c FROM plt1 t1, pl
  Gather Motion 3:1  (slice1; segments: 3)
    Merge Key: t1.c, t3.c
    ->  GroupAggregate
-         Group Key: t1.c, t2.c, t3.c
+         Group Key: t1.c, t3.c
          ->  Sort
                Sort Key: t1.c, t3.c
                ->  Redistribute Motion 3:3  (slice2; segments: 3)
-                     Hash Key: t1.c, t1.c, t3.c
+                     Hash Key: t1.c, t3.c
                      ->  Append
                            ->  Hash Join
                                  Hash Cond: (ltrim(t3_1.c, 'A'::text) = t1_1.c)
@@ -1762,11 +1768,11 @@ SELECT avg(t1.a), avg(t2.b), avg(t3.a + t3.b), t1.c, 
t2.c, t3.c FROM pht1 t1, ph
  Gather Motion 3:1  (slice1; segments: 3)
    Merge Key: t1.c, t3.c
    ->  GroupAggregate
-         Group Key: t1.c, t2.c, t3.c
+         Group Key: t1.c, t3.c
          ->  Sort
                Sort Key: t1.c, t3.c
                ->  Redistribute Motion 3:3  (slice2; segments: 3)
-                     Hash Key: t1.c, t1.c, t3.c
+                     Hash Key: t1.c, t3.c
                      ->  Append
                            ->  Hash Join
                                  Hash Cond: ((t1_1.b = t2_1.b) AND (t1_1.c = 
t2_1.c))
@@ -1875,11 +1881,11 @@ SELECT avg(t1.a), avg(t2.b), t1.c, t2.c FROM plt1 t1 
RIGHT JOIN plt2 t2 ON t1.c
    ->  Sort
          Sort Key: t1.c
          ->  Finalize HashAggregate
-               Group Key: t1.c, t2.c
+               Group Key: t1.c
                ->  Redistribute Motion 3:3  (slice2; segments: 3)
-                     Hash Key: t1.c, t1.c
+                     Hash Key: t1.c
                      ->  Partial HashAggregate
-                           Group Key: t1.c, t2.c
+                           Group Key: t1.c
                            ->  Append
                                  ->  Hash Join
                                        Hash Cond: (t2_1.c = t1_1.c)
@@ -2537,20 +2543,20 @@ where not exists (select 1 from prtx2
 
--------------------------------------------------------------------------------
  Gather Motion 3:1  (slice1; segments: 3)
    ->  Append
-         ->  Hash Anti Join
-               Hash Cond: ((prtx1_1.a = prtx2_1.a) AND (prtx1_1.b = prtx2_1.b))
-               ->  Seq Scan on prtx1_1
-                     Filter: ((a < 20) AND (c = 120))
+         ->  Hash Right Anti Join
+               Hash Cond: ((prtx2_1.a = prtx1_1.a) AND (prtx2_1.b = prtx1_1.b))
+               ->  Seq Scan on prtx2_1
+                     Filter: (c = 123)
                ->  Hash
-                     ->  Seq Scan on prtx2_1
-                           Filter: (c = 123)
-         ->  Hash Anti Join
-               Hash Cond: ((prtx1_2.a = prtx2_2.a) AND (prtx1_2.b = prtx2_2.b))
-               ->  Seq Scan on prtx1_2
-                     Filter: ((a < 20) AND (c = 120))
+                     ->  Seq Scan on prtx1_1
+                           Filter: ((a < 20) AND (c = 120))
+         ->  Hash Right Anti Join
+               Hash Cond: ((prtx2_2.a = prtx1_2.a) AND (prtx2_2.b = prtx1_2.b))
+               ->  Seq Scan on prtx2_2
+                     Filter: (c = 123)
                ->  Hash
-                     ->  Seq Scan on prtx2_2
-                           Filter: (c = 123)
+                     ->  Seq Scan on prtx1_2
+                           Filter: ((a < 20) AND (c = 120))
  Optimizer: Postgres query optimizer
 (17 rows)
 
@@ -2572,20 +2578,20 @@ where not exists (select 1 from prtx2
 
--------------------------------------------------------------------------------
  Gather Motion 3:1  (slice1; segments: 3)
    ->  Append
-         ->  Hash Anti Join
-               Hash Cond: (prtx1_1.a = prtx2_1.a)
+         ->  Hash Right Anti Join
+               Hash Cond: (prtx2_1.a = prtx1_1.a)
                Join Filter: ((prtx2_1.b = (prtx1_1.b + 1)) OR (prtx2_1.c = 99))
-               ->  Seq Scan on prtx1_1
-                     Filter: ((a < 20) AND (c = 91))
+               ->  Seq Scan on prtx2_1
                ->  Hash
-                     ->  Seq Scan on prtx2_1
-         ->  Hash Anti Join
-               Hash Cond: (prtx1_2.a = prtx2_2.a)
+                     ->  Seq Scan on prtx1_1
+                           Filter: ((a < 20) AND (c = 91))
+         ->  Hash Right Anti Join
+               Hash Cond: (prtx2_2.a = prtx1_2.a)
                Join Filter: ((prtx2_2.b = (prtx1_2.b + 1)) OR (prtx2_2.c = 99))
-               ->  Seq Scan on prtx1_2
-                     Filter: ((a < 20) AND (c = 91))
+               ->  Seq Scan on prtx2_2
                ->  Hash
-                     ->  Seq Scan on prtx2_2
+                     ->  Seq Scan on prtx1_2
+                           Filter: ((a < 20) AND (c = 91))
  Optimizer: Postgres query optimizer
 (17 rows)
 
@@ -2796,37 +2802,37 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_adv t1 LEFT 
JOIN prt2_adv t2 ON (t1.a =
 -- anti join
 EXPLAIN (COSTS OFF)
 SELECT t1.* FROM prt1_adv t1 WHERE NOT EXISTS (SELECT 1 FROM prt2_adv t2 WHERE 
t1.a = t2.b) AND t1.b = 0 ORDER BY t1.a;
-                                  QUERY PLAN                                  
-------------------------------------------------------------------------------
+                               QUERY PLAN                               
+------------------------------------------------------------------------
  Gather Motion 3:1  (slice1; segments: 3)
    Merge Key: t1.a
    ->  Sort
          Sort Key: t1.a
          ->  Append
-               ->  Hash Anti Join
-                     Hash Cond: (t1_1.a = t2_1.b)
-                     ->  Seq Scan on prt1_adv_p1 t1_1
-                           Filter: (b = 0)
+               ->  Hash Right Anti Join
+                     Hash Cond: (t2_1.b = t1_1.a)
+                     ->  Redistribute Motion 3:3  (slice2; segments: 3)
+                           Hash Key: t2_1.b
+                           ->  Seq Scan on prt2_adv_p1 t2_1
                      ->  Hash
-                           ->  Redistribute Motion 3:3  (slice2; segments: 3)
-                                 Hash Key: t2_1.b
-                                 ->  Seq Scan on prt2_adv_p1 t2_1
-               ->  Hash Anti Join
-                     Hash Cond: (t1_2.a = t2_2.b)
-                     ->  Seq Scan on prt1_adv_p2 t1_2
-                           Filter: (b = 0)
+                           ->  Seq Scan on prt1_adv_p1 t1_1
+                                 Filter: (b = 0)
+               ->  Hash Right Anti Join
+                     Hash Cond: (t2_2.b = t1_2.a)
+                     ->  Redistribute Motion 3:3  (slice3; segments: 3)
+                           Hash Key: t2_2.b
+                           ->  Seq Scan on prt2_adv_p2 t2_2
                      ->  Hash
-                           ->  Redistribute Motion 3:3  (slice3; segments: 3)
-                                 Hash Key: t2_2.b
-                                 ->  Seq Scan on prt2_adv_p2 t2_2
-               ->  Hash Anti Join
-                     Hash Cond: (t1_3.a = t2_3.b)
-                     ->  Seq Scan on prt1_adv_p3 t1_3
-                           Filter: (b = 0)
+                           ->  Seq Scan on prt1_adv_p2 t1_2
+                                 Filter: (b = 0)
+               ->  Hash Right Anti Join
+                     Hash Cond: (t2_3.b = t1_3.a)
+                     ->  Redistribute Motion 3:3  (slice4; segments: 3)
+                           Hash Key: t2_3.b
+                           ->  Seq Scan on prt2_adv_p3 t2_3
                      ->  Hash
-                           ->  Redistribute Motion 3:3  (slice4; segments: 3)
-                                 Hash Key: t2_3.b
-                                 ->  Seq Scan on prt2_adv_p3 t2_3
+                           ->  Seq Scan on prt1_adv_p3 t1_3
+                                 Filter: (b = 0)
  Optimizer: Postgres query optimizer
 (30 rows)
 
@@ -2860,25 +2866,25 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT 175 phv, * 
FROM prt1_adv WHERE prt1_a
                                  ->  Seq Scan on prt2_adv_p1 prt2_adv_1
                                        Filter: (a = 0)
                ->  Hash Full Join
-                     Hash Cond: (prt2_adv_2.b = prt1_adv_2.a)
+                     Hash Cond: (prt1_adv_2.a = prt2_adv_2.b)
                      Filter: (((175) = prt1_adv_2.a) OR ((425) = prt2_adv_2.b))
-                     ->  Redistribute Motion 1:3  (slice3; segments: 1)
-                           Hash Key: prt2_adv_2.b
-                           ->  Seq Scan on prt2_adv_p2 prt2_adv_2
-                                 Filter: (a = 0)
+                     ->  Seq Scan on prt1_adv_p2 prt1_adv_2
+                           Filter: (b = 0)
                      ->  Hash
-                           ->  Seq Scan on prt1_adv_p2 prt1_adv_2
-                                 Filter: (b = 0)
+                           ->  Redistribute Motion 1:3  (slice3; segments: 1)
+                                 Hash Key: prt2_adv_2.b
+                                 ->  Seq Scan on prt2_adv_p2 prt2_adv_2
+                                       Filter: (a = 0)
                ->  Hash Full Join
                      Hash Cond: (prt2_adv_3.b = prt1_adv_3.a)
                      Filter: (((175) = prt1_adv_3.a) OR ((425) = prt2_adv_3.b))
-                     ->  Redistribute Motion 1:3  (slice4; segments: 1)
-                           Hash Key: prt2_adv_3.b
-                           ->  Seq Scan on prt2_adv_p3 prt2_adv_3
-                                 Filter: (a = 0)
+                     ->  Seq Scan on prt2_adv_p3 prt2_adv_3
+                           Filter: (a = 0)
                      ->  Hash
-                           ->  Seq Scan on prt1_adv_p3 prt1_adv_3
-                                 Filter: (b = 0)
+                           ->  Redistribute Motion 3:3  (slice4; segments: 3)
+                                 Hash Key: 0
+                                 ->  Seq Scan on prt1_adv_p3 prt1_adv_3
+                                       Filter: (b = 0)
  Optimizer: Postgres query optimizer
 (36 rows)
 
@@ -3098,37 +3104,37 @@ SELECT t1.b, t1.c, t2.a, t2.c FROM prt2_adv t1 LEFT 
JOIN prt1_adv t2 ON (t1.b =
 -- anti join
 EXPLAIN (COSTS OFF)
 SELECT t1.* FROM prt1_adv t1 WHERE NOT EXISTS (SELECT 1 FROM prt2_adv t2 WHERE 
t1.a = t2.b) AND t1.b = 0 ORDER BY t1.a;
-                                  QUERY PLAN                                  
-------------------------------------------------------------------------------
+                               QUERY PLAN                               
+------------------------------------------------------------------------
  Gather Motion 3:1  (slice1; segments: 3)
    Merge Key: t1.a
    ->  Sort
          Sort Key: t1.a
          ->  Append
-               ->  Hash Anti Join
-                     Hash Cond: (t1_1.a = t2_1.b)
-                     ->  Seq Scan on prt1_adv_p1 t1_1
-                           Filter: (b = 0)
+               ->  Hash Right Anti Join
+                     Hash Cond: (t2_1.b = t1_1.a)
+                     ->  Redistribute Motion 3:3  (slice2; segments: 3)
+                           Hash Key: t2_1.b
+                           ->  Seq Scan on prt2_adv_p1 t2_1
                      ->  Hash
-                           ->  Redistribute Motion 3:3  (slice2; segments: 3)
-                                 Hash Key: t2_1.b
-                                 ->  Seq Scan on prt2_adv_p1 t2_1
-               ->  Hash Anti Join
-                     Hash Cond: (t1_2.a = t2_2.b)
-                     ->  Seq Scan on prt1_adv_p2 t1_2
-                           Filter: (b = 0)
+                           ->  Seq Scan on prt1_adv_p1 t1_1
+                                 Filter: (b = 0)
+               ->  Hash Right Anti Join
+                     Hash Cond: (t2_2.b = t1_2.a)
+                     ->  Redistribute Motion 3:3  (slice3; segments: 3)
+                           Hash Key: t2_2.b
+                           ->  Seq Scan on prt2_adv_p2 t2_2
                      ->  Hash
-                           ->  Redistribute Motion 3:3  (slice3; segments: 3)
-                                 Hash Key: t2_2.b
-                                 ->  Seq Scan on prt2_adv_p2 t2_2
-               ->  Hash Anti Join
-                     Hash Cond: (t1_3.a = t2_3.b)
-                     ->  Seq Scan on prt1_adv_p3 t1_3
-                           Filter: (b = 0)
+                           ->  Seq Scan on prt1_adv_p2 t1_2
+                                 Filter: (b = 0)
+               ->  Hash Right Anti Join
+                     Hash Cond: (t2_3.b = t1_3.a)
+                     ->  Redistribute Motion 3:3  (slice4; segments: 3)
+                           Hash Key: t2_3.b
+                           ->  Seq Scan on prt2_adv_p3 t2_3
                      ->  Hash
-                           ->  Redistribute Motion 3:3  (slice4; segments: 3)
-                                 Hash Key: t2_3.b
-                                 ->  Seq Scan on prt2_adv_p3 t2_3
+                           ->  Seq Scan on prt1_adv_p3 t1_3
+                                 Filter: (b = 0)
  Optimizer: Postgres query optimizer
 (30 rows)
 
@@ -3145,30 +3151,30 @@ SELECT t1.* FROM prt1_adv t1 WHERE NOT EXISTS (SELECT 1 
FROM prt2_adv t2 WHERE t
 -- partitions on the nullable side
 EXPLAIN (COSTS OFF)
 SELECT t1.* FROM prt2_adv t1 WHERE NOT EXISTS (SELECT 1 FROM prt1_adv t2 WHERE 
t1.b = t2.a) AND t1.a = 0 ORDER BY t1.b;
-                            QUERY PLAN                            
-------------------------------------------------------------------
+                               QUERY PLAN                               
+------------------------------------------------------------------------
  Gather Motion 3:1  (slice1; segments: 3)
    Merge Key: t1.b
    ->  Sort
          Sort Key: t1.b
-         ->  Hash Anti Join
-               Hash Cond: (t1.b = t2.a)
-               ->  Redistribute Motion 1:3  (slice2; segments: 1)
-                     Hash Key: t1.b
-                     ->  Append
-                           ->  Seq Scan on prt2_adv_p1 t1_1
-                                 Filter: (a = 0)
-                           ->  Seq Scan on prt2_adv_p2 t1_2
-                                 Filter: (a = 0)
-                           ->  Seq Scan on prt2_adv_p3 t1_3
-                                 Filter: (a = 0)
-                           ->  Seq Scan on prt2_adv_extra t1_4
-                                 Filter: (a = 0)
+         ->  Hash Right Anti Join
+               Hash Cond: (t2.a = t1.b)
+               ->  Append
+                     ->  Seq Scan on prt1_adv_p1 t2_1
+                     ->  Seq Scan on prt1_adv_p2 t2_2
+                     ->  Seq Scan on prt1_adv_p3 t2_3
                ->  Hash
-                     ->  Append
-                           ->  Seq Scan on prt1_adv_p1 t2_1
-                           ->  Seq Scan on prt1_adv_p2 t2_2
-                           ->  Seq Scan on prt1_adv_p3 t2_3
+                     ->  Redistribute Motion 1:3  (slice2; segments: 1)
+                           Hash Key: t1.b
+                           ->  Append
+                                 ->  Seq Scan on prt2_adv_p1 t1_1
+                                       Filter: (a = 0)
+                                 ->  Seq Scan on prt2_adv_p2 t1_2
+                                       Filter: (a = 0)
+                                 ->  Seq Scan on prt2_adv_p3 t1_3
+                                       Filter: (a = 0)
+                                 ->  Seq Scan on prt2_adv_extra t1_4
+                                       Filter: (a = 0)
  Optimizer: Postgres query optimizer
 (23 rows)
 
@@ -3375,29 +3381,29 @@ SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_adv t1 LEFT 
JOIN prt2_adv t2 ON (t1.a =
 -- anti join
 EXPLAIN (COSTS OFF)
 SELECT t1.* FROM prt1_adv t1 WHERE NOT EXISTS (SELECT 1 FROM prt2_adv t2 WHERE 
t1.a = t2.b) AND t1.b = 0 ORDER BY t1.a;
-                               QUERY PLAN                               
-------------------------------------------------------------------------
+                            QUERY PLAN                            
+------------------------------------------------------------------
  Gather Motion 3:1  (slice1; segments: 3)
    Merge Key: t1.a
    ->  Sort
          Sort Key: t1.a
-         ->  Hash Anti Join
-               Hash Cond: (t1.a = t2.b)
-               ->  Append
-                     ->  Seq Scan on prt1_adv_p1 t1_1
-                           Filter: (b = 0)
-                     ->  Seq Scan on prt1_adv_p2 t1_2
-                           Filter: (b = 0)
-                     ->  Seq Scan on prt1_adv_p3 t1_3
-                           Filter: (b = 0)
+         ->  Hash Right Anti Join
+               Hash Cond: (t2.b = t1.a)
+               ->  Redistribute Motion 3:3  (slice2; segments: 3)
+                     Hash Key: t2.b
+                     ->  Append
+                           ->  Seq Scan on prt2_adv_p1 t2_1
+                           ->  Seq Scan on prt2_adv_p2 t2_2
+                           ->  Seq Scan on prt2_adv_p3_1 t2_3
+                           ->  Seq Scan on prt2_adv_p3_2 t2_4
                ->  Hash
-                     ->  Redistribute Motion 3:3  (slice2; segments: 3)
-                           Hash Key: t2.b
-                           ->  Append
-                                 ->  Seq Scan on prt2_adv_p1 t2_1
-                                 ->  Seq Scan on prt2_adv_p2 t2_2
-                                 ->  Seq Scan on prt2_adv_p3_1 t2_3
-                                 ->  Seq Scan on prt2_adv_p3_2 t2_4
+                     ->  Append
+                           ->  Seq Scan on prt1_adv_p1 t1_1
+                                 Filter: (b = 0)
+                           ->  Seq Scan on prt1_adv_p2 t1_2
+                                 Filter: (b = 0)
+                           ->  Seq Scan on prt1_adv_p3 t1_3
+                                 Filter: (b = 0)
  Optimizer: Postgres query optimizer
 (22 rows)
 
@@ -3891,24 +3897,24 @@ SELECT t1.* FROM plt1_adv t1 WHERE NOT EXISTS (SELECT 1 
FROM plt2_adv t2 WHERE t
    ->  Sort
          Sort Key: t1.a
          ->  Append
-               ->  Hash Anti Join
-                     Hash Cond: ((t1_1.a = t2_1.a) AND (t1_1.c = t2_1.c))
-                     ->  Seq Scan on plt1_adv_p1 t1_1
-                           Filter: (b < 10)
+               ->  Hash Right Anti Join
+                     Hash Cond: ((t2_1.a = t1_1.a) AND (t2_1.c = t1_1.c))
+                     ->  Seq Scan on plt2_adv_p1 t2_1
                      ->  Hash
-                           ->  Seq Scan on plt2_adv_p1 t2_1
-               ->  Hash Anti Join
-                     Hash Cond: ((t1_2.a = t2_2.a) AND (t1_2.c = t2_2.c))
-                     ->  Seq Scan on plt1_adv_p2 t1_2
-                           Filter: (b < 10)
+                           ->  Seq Scan on plt1_adv_p1 t1_1
+                                 Filter: (b < 10)
+               ->  Hash Right Anti Join
+                     Hash Cond: ((t2_2.a = t1_2.a) AND (t2_2.c = t1_2.c))
+                     ->  Seq Scan on plt2_adv_p2 t2_2
                      ->  Hash
-                           ->  Seq Scan on plt2_adv_p2 t2_2
-               ->  Hash Anti Join
-                     Hash Cond: ((t1_3.a = t2_3.a) AND (t1_3.c = t2_3.c))
-                     ->  Seq Scan on plt1_adv_p3 t1_3
-                           Filter: (b < 10)
+                           ->  Seq Scan on plt1_adv_p2 t1_2
+                                 Filter: (b < 10)
+               ->  Hash Right Anti Join
+                     Hash Cond: ((t2_3.a = t1_3.a) AND (t2_3.c = t1_3.c))
+                     ->  Seq Scan on plt2_adv_p3 t2_3
                      ->  Hash
-                           ->  Seq Scan on plt2_adv_p3 t2_3
+                           ->  Seq Scan on plt1_adv_p3 t1_3
+                                 Filter: (b < 10)
  Optimizer: Postgres query optimizer
 (24 rows)
 
@@ -4151,24 +4157,24 @@ SELECT t1.* FROM plt1_adv t1 WHERE NOT EXISTS (SELECT 1 
FROM plt2_adv t2 WHERE t
    ->  Sort
          Sort Key: t1.a
          ->  Append
-               ->  Hash Anti Join
-                     Hash Cond: ((t1_1.a = t2_1.a) AND (t1_1.c = t2_1.c))
-                     ->  Seq Scan on plt1_adv_p1 t1_1
-                           Filter: (b < 10)
+               ->  Hash Right Anti Join
+                     Hash Cond: ((t2_1.a = t1_1.a) AND (t2_1.c = t1_1.c))
+                     ->  Seq Scan on plt2_adv_p1 t2_1
                      ->  Hash
-                           ->  Seq Scan on plt2_adv_p1 t2_1
-               ->  Hash Anti Join
-                     Hash Cond: ((t1_2.a = t2_2.a) AND (t1_2.c = t2_2.c))
-                     ->  Seq Scan on plt1_adv_p2 t1_2
-                           Filter: (b < 10)
+                           ->  Seq Scan on plt1_adv_p1 t1_1
+                                 Filter: (b < 10)
+               ->  Hash Right Anti Join
+                     Hash Cond: ((t2_2.a = t1_2.a) AND (t2_2.c = t1_2.c))
+                     ->  Seq Scan on plt2_adv_p2 t2_2
                      ->  Hash
-                           ->  Seq Scan on plt2_adv_p2 t2_2
-               ->  Hash Anti Join
-                     Hash Cond: ((t1_3.a = t2_3.a) AND (t1_3.c = t2_3.c))
-                     ->  Seq Scan on plt1_adv_p3 t1_3
-                           Filter: (b < 10)
+                           ->  Seq Scan on plt1_adv_p2 t1_2
+                                 Filter: (b < 10)
+               ->  Hash Right Anti Join
+                     Hash Cond: ((t2_3.a = t1_3.a) AND (t2_3.c = t1_3.c))
+                     ->  Seq Scan on plt2_adv_p3 t2_3
                      ->  Hash
-                           ->  Seq Scan on plt2_adv_p3 t2_3
+                           ->  Seq Scan on plt1_adv_p3 t1_3
+                                 Filter: (b < 10)
  Optimizer: Postgres query optimizer
 (24 rows)
 
@@ -4183,28 +4189,28 @@ SELECT t1.* FROM plt1_adv t1 WHERE NOT EXISTS (SELECT 1 
FROM plt2_adv t2 WHERE t
 -- partitions on the nullable side
 EXPLAIN (COSTS OFF)
 SELECT t1.* FROM plt2_adv t1 WHERE NOT EXISTS (SELECT 1 FROM plt1_adv t2 WHERE 
t1.a = t2.a AND t1.c = t2.c) AND t1.b < 10 ORDER BY t1.a;
-                         QUERY PLAN                         
-------------------------------------------------------------
+                          QUERY PLAN                           
+---------------------------------------------------------------
  Gather Motion 3:1  (slice1; segments: 3)
    Merge Key: t1.a
    ->  Sort
          Sort Key: t1.a
-         ->  Hash Anti Join
-               Hash Cond: ((t1.a = t2.a) AND (t1.c = t2.c))
+         ->  Hash Right Anti Join
+               Hash Cond: ((t2.a = t1.a) AND (t2.c = t1.c))
                ->  Append
-                     ->  Seq Scan on plt2_adv_extra t1_1
-                           Filter: (b < 10)
-                     ->  Seq Scan on plt2_adv_p1 t1_2
-                           Filter: (b < 10)
-                     ->  Seq Scan on plt2_adv_p2 t1_3
-                           Filter: (b < 10)
-                     ->  Seq Scan on plt2_adv_p3 t1_4
-                           Filter: (b < 10)
+                     ->  Seq Scan on plt1_adv_p1 t2_1
+                     ->  Seq Scan on plt1_adv_p2 t2_2
+                     ->  Seq Scan on plt1_adv_p3 t2_3
                ->  Hash
                      ->  Append
-                           ->  Seq Scan on plt1_adv_p1 t2_1
-                           ->  Seq Scan on plt1_adv_p2 t2_2
-                           ->  Seq Scan on plt1_adv_p3 t2_3
+                           ->  Seq Scan on plt2_adv_extra t1_1
+                                 Filter: (b < 10)
+                           ->  Seq Scan on plt2_adv_p1 t1_2
+                                 Filter: (b < 10)
+                           ->  Seq Scan on plt2_adv_p2 t1_3
+                                 Filter: (b < 10)
+                           ->  Seq Scan on plt2_adv_p3 t1_4
+                                 Filter: (b < 10)
  Optimizer: Postgres query optimizer
 (21 rows)
 
@@ -4341,27 +4347,27 @@ SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 LEFT 
JOIN plt2_adv t2 ON (t1.a =
 -- anti join
 EXPLAIN (COSTS OFF)
 SELECT t1.* FROM plt1_adv t1 WHERE NOT EXISTS (SELECT 1 FROM plt2_adv t2 WHERE 
t1.a = t2.a AND t1.c = t2.c) AND t1.b < 10 ORDER BY t1.a;
-                          QUERY PLAN                          
---------------------------------------------------------------
+                         QUERY PLAN                         
+------------------------------------------------------------
  Gather Motion 3:1  (slice1; segments: 3)
    Merge Key: t1.a
    ->  Sort
          Sort Key: t1.a
-         ->  Hash Anti Join
-               Hash Cond: ((t1.a = t2.a) AND (t1.c = t2.c))
+         ->  Hash Right Anti Join
+               Hash Cond: ((t2.a = t1.a) AND (t2.c = t1.c))
                ->  Append
-                     ->  Seq Scan on plt1_adv_p1 t1_1
-                           Filter: (b < 10)
-                     ->  Seq Scan on plt1_adv_p2 t1_2
-                           Filter: (b < 10)
-                     ->  Seq Scan on plt1_adv_p3 t1_3
-                           Filter: (b < 10)
+                     ->  Seq Scan on plt2_adv_p1 t2_1
+                     ->  Seq Scan on plt2_adv_p2_1 t2_2
+                     ->  Seq Scan on plt2_adv_p2_2 t2_3
+                     ->  Seq Scan on plt2_adv_p3 t2_4
                ->  Hash
                      ->  Append
-                           ->  Seq Scan on plt2_adv_p1 t2_1
-                           ->  Seq Scan on plt2_adv_p2_1 t2_2
-                           ->  Seq Scan on plt2_adv_p2_2 t2_3
-                           ->  Seq Scan on plt2_adv_p3 t2_4
+                           ->  Seq Scan on plt1_adv_p1 t1_1
+                                 Filter: (b < 10)
+                           ->  Seq Scan on plt1_adv_p2 t1_2
+                                 Filter: (b < 10)
+                           ->  Seq Scan on plt1_adv_p3 t1_3
+                                 Filter: (b < 10)
  Optimizer: Postgres query optimizer
 (20 rows)
 
@@ -4561,24 +4567,24 @@ SELECT t1.* FROM plt1_adv t1 WHERE NOT EXISTS (SELECT 1 
FROM plt2_adv t2 WHERE t
    ->  Sort
          Sort Key: t1.a
          ->  Append
-               ->  Hash Anti Join
-                     Hash Cond: ((t1_1.a = t2_1.a) AND (t1_1.c = t2_1.c))
-                     ->  Seq Scan on plt1_adv_p1_null t1_1
-                           Filter: (b < 10)
+               ->  Hash Right Anti Join
+                     Hash Cond: ((t2_1.a = t1_1.a) AND (t2_1.c = t1_1.c))
+                     ->  Seq Scan on plt2_adv_p1 t2_1
                      ->  Hash
-                           ->  Seq Scan on plt2_adv_p1 t2_1
-               ->  Hash Anti Join
-                     Hash Cond: ((t1_2.a = t2_2.a) AND (t1_2.c = t2_2.c))
-                     ->  Seq Scan on plt1_adv_p2 t1_2
-                           Filter: (b < 10)
+                           ->  Seq Scan on plt1_adv_p1_null t1_1
+                                 Filter: (b < 10)
+               ->  Hash Right Anti Join
+                     Hash Cond: ((t2_2.a = t1_2.a) AND (t2_2.c = t1_2.c))
+                     ->  Seq Scan on plt2_adv_p2 t2_2
                      ->  Hash
-                           ->  Seq Scan on plt2_adv_p2 t2_2
-               ->  Hash Anti Join
-                     Hash Cond: ((t1_3.a = t2_3.a) AND (t1_3.c = t2_3.c))
-                     ->  Seq Scan on plt1_adv_p3 t1_3
-                           Filter: (b < 10)
+                           ->  Seq Scan on plt1_adv_p2 t1_2
+                                 Filter: (b < 10)
+               ->  Hash Right Anti Join
+                     Hash Cond: ((t2_3.a = t1_3.a) AND (t2_3.c = t1_3.c))
+                     ->  Seq Scan on plt2_adv_p3_null t2_3
                      ->  Hash
-                           ->  Seq Scan on plt2_adv_p3_null t2_3
+                           ->  Seq Scan on plt1_adv_p3 t1_3
+                                 Filter: (b < 10)
  Optimizer: Postgres query optimizer
 (24 rows)
 
diff --git a/contrib/pax_storage/src/test/regress/expected/partition_prune.out 
b/contrib/pax_storage/src/test/regress/expected/partition_prune.out
index b3673b2ce48..90236d1f7e1 100644
--- a/contrib/pax_storage/src/test/regress/expected/partition_prune.out
+++ b/contrib/pax_storage/src/test/regress/expected/partition_prune.out
@@ -1252,25 +1252,31 @@ explain (costs off) select * from boolpart where a is 
true or a is not true;
                Filter: ((a IS TRUE) OR (a IS NOT TRUE))
          ->  Seq Scan on boolpart_t boolpart_2
                Filter: ((a IS TRUE) OR (a IS NOT TRUE))
+         ->  Seq Scan on boolpart_default boolpart_3
+               Filter: ((a IS TRUE) OR (a IS NOT TRUE))
  Optimizer: Postgres query optimizer
-(7 rows)
+(9 rows)
 
 explain (costs off) select * from boolpart where a is not true;
-                QUERY PLAN                
-------------------------------------------
+                     QUERY PLAN                      
+-----------------------------------------------------
  Gather Motion 3:1  (slice1; segments: 3)
-   ->  Seq Scan on boolpart_f boolpart
-         Filter: (a IS NOT TRUE)
+   ->  Append
+         ->  Seq Scan on boolpart_f boolpart_1
+               Filter: (a IS NOT TRUE)
+         ->  Seq Scan on boolpart_default boolpart_2
+               Filter: (a IS NOT TRUE)
  Optimizer: Postgres query optimizer
-(4 rows)
+(7 rows)
 
 explain (costs off) select * from boolpart where a is not true and a is not 
false;
-             QUERY PLAN              
--------------------------------------
- Result
-   One-Time Filter: false
+                       QUERY PLAN                       
+--------------------------------------------------------
+ Gather Motion 3:1  (slice1; segments: 3)
+   ->  Seq Scan on boolpart_default boolpart
+         Filter: ((a IS NOT TRUE) AND (a IS NOT FALSE))
  Optimizer: Postgres query optimizer
-(3 rows)
+(4 rows)
 
 explain (costs off) select * from boolpart where a is unknown;
                      QUERY PLAN                      
@@ -2411,7 +2417,7 @@ select explain_parallel_append('select avg(ab.a) from ab 
inner join lprt_a a on
                                              Index Cond: (a = ANY 
('{0,0,1}'::integer[]))
                      ->  Sort (actual rows=N loops=N)
                            Sort Key: a.a
-                           Sort Method:  quicksort  Memory: 60kB
+                           Sort Method:  quicksort  Memory: 25kB
                            ->  Partition Selector (selector id: $0) (actual 
rows=N loops=N)
                                  ->  Seq Scan on lprt_a a (actual rows=N 
loops=N)
                                        Filter: (a = ANY ('{0,0,1}'::integer[]))
@@ -4177,7 +4183,7 @@ explain (costs off) update listp1 set a = 1 where a = 2;
 ---------------------------------------------------------------
  Update on listp1
    ->  Explicit Redistribute Motion 1:3  (slice1; segments: 1)
-         ->  Split
+         ->  Split Update
                ->  Seq Scan on listp1
                      Filter: (a = 2)
  Optimizer: Postgres query optimizer
diff --git a/contrib/pax_storage/src/test/regress/expected/polymorphism.out 
b/contrib/pax_storage/src/test/regress/expected/polymorphism.out
index 4af1758f17a..92f5476dc25 100644
--- a/contrib/pax_storage/src/test/regress/expected/polymorphism.out
+++ b/contrib/pax_storage/src/test/regress/expected/polymorphism.out
@@ -1818,10 +1818,10 @@ select * from dfview;
  c3     | bigint |           |          |         | plain   | 
  c4     | bigint |           |          |         | plain   | 
 View definition:
- SELECT int8_tbl.q1,
-    int8_tbl.q2,
-    dfunc(int8_tbl.q1, int8_tbl.q2, flag => int8_tbl.q1 > int8_tbl.q2) AS c3,
-    dfunc(int8_tbl.q1, flag => int8_tbl.q1 < int8_tbl.q2, b => int8_tbl.q2) AS 
c4
+ SELECT q1,
+    q2,
+    dfunc(q1, q2, flag => q1 > q2) AS c3,
+    dfunc(q1, flag => q1 < q2, b => q2) AS c4
    FROM int8_tbl;
 
 drop view dfview;
diff --git a/contrib/pax_storage/src/test/regress/expected/prepare.out 
b/contrib/pax_storage/src/test/regress/expected/prepare.out
index 8eb2264fc74..3306c696b17 100644
--- a/contrib/pax_storage/src/test/regress/expected/prepare.out
+++ b/contrib/pax_storage/src/test/regress/expected/prepare.out
@@ -61,7 +61,7 @@ PREPARE q2(text) AS
 EXECUTE q2('postgres');
  datname  | datistemplate | datallowconn 
 ----------+---------------+--------------
- postgres | t             | t
+ postgres | f             | t
 (1 row)
 
 PREPARE q3(text, int, float, boolean, smallint) AS
diff --git a/contrib/pax_storage/src/test/regress/expected/rangefuncs.out 
b/contrib/pax_storage/src/test/regress/expected/rangefuncs.out
index 7bb2a658b1e..92c4b79de44 100644
--- a/contrib/pax_storage/src/test/regress/expected/rangefuncs.out
+++ b/contrib/pax_storage/src/test/regress/expected/rangefuncs.out
@@ -149,9 +149,9 @@ select * from vw_ord;
 select definition from pg_views where viewname='vw_ord';
                                        definition                              
         
 
----------------------------------------------------------------------------------------
-  SELECT z.a,                                                                  
        +
-     z.b,                                                                      
        +
-     z.c                                                                       
        +
+  SELECT a,                                                                    
        +
+     b,                                                                        
        +
+     c                                                                         
        +
     FROM UNNEST(ARRAY[10, 20], ARRAY['foo'::text, 'bar'::text], ARRAY[1.0]) 
z(a, b, c);
 (1 row)
 
@@ -167,9 +167,9 @@ select * from vw_ord;
 select definition from pg_views where viewname='vw_ord';
                                        definition                              
         
 
----------------------------------------------------------------------------------------
-  SELECT z.a,                                                                  
        +
-     z.b,                                                                      
        +
-     z.c                                                                       
        +
+  SELECT a,                                                                    
        +
+     b,                                                                        
        +
+     c                                                                         
        +
     FROM UNNEST(ARRAY[10, 20], ARRAY['foo'::text, 'bar'::text], ARRAY[1.0]) 
z(a, b, c);
 (1 row)
 
@@ -185,9 +185,9 @@ select * from vw_ord;
 select definition from pg_views where viewname='vw_ord';
                                                       definition               
                                       
 
----------------------------------------------------------------------------------------------------------------------
-  SELECT z.a,                                                                  
                                      +
-     z.b,                                                                      
                                      +
-     z.c                                                                       
                                      +
+  SELECT a,                                                                    
                                      +
+     b,                                                                        
                                      +
+     c                                                                         
                                      +
     FROM ROWS FROM(unnest(ARRAY[10, 20]), unnest(ARRAY['foo'::text, 
'bar'::text]), generate_series(1, 2)) z(a, b, c);
 (1 row)
 
@@ -608,14 +608,14 @@ select * from vw_rngfunc;
 select pg_get_viewdef('vw_rngfunc');
                                                                                
 pg_get_viewdef                                                                 
               
 
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-  SELECT t1.a,                                                                 
                                                                                
              +
-     t1.b,                                                                     
                                                                                
              +
-     t1.c,                                                                     
                                                                                
              +
-     t1.d,                                                                     
                                                                                
              +
-     t1.e,                                                                     
                                                                                
              +
-     t1.f,                                                                     
                                                                                
              +
-     t1.g,                                                                     
                                                                                
              +
-     t1.n                                                                      
                                                                                
              +
+  SELECT a,                                                                    
                                                                                
              +
+     b,                                                                        
                                                                                
              +
+     c,                                                                        
                                                                                
              +
+     d,                                                                        
                                                                                
              +
+     e,                                                                        
                                                                                
              +
+     f,                                                                        
                                                                                
              +
+     g,                                                                        
                                                                                
              +
+     n                                                                         
                                                                                
              +
     FROM ROWS FROM(getrngfunc9(1), getrngfunc7(1) AS (rngfuncid integer, 
rngfuncsubid integer, rngfuncname text), getrngfunc1(1)) WITH ORDINALITY t1(a, 
b, c, d, e, f, g, n);
 (1 row)
 
diff --git a/contrib/pax_storage/src/test/regress/expected/sequence.out 
b/contrib/pax_storage/src/test/regress/expected/sequence.out
index 099cf98163b..71269bcc28b 100644
--- a/contrib/pax_storage/src/test/regress/expected/sequence.out
+++ b/contrib/pax_storage/src/test/regress/expected/sequence.out
@@ -21,7 +21,8 @@ CREATE SEQUENCE sequence_testx OWNED BY nobody;  -- nonsense 
word
 ERROR:  invalid OWNED BY option
 HINT:  Specify OWNED BY table.column or OWNED BY NONE.
 CREATE SEQUENCE sequence_testx OWNED BY pg_class_oid_index.oid;  -- not a table
-ERROR:  referenced relation "pg_class_oid_index" is not a table or foreign 
table
+ERROR:  sequence cannot be owned by relation "pg_class_oid_index"  (seg0 
127.0.1.1:7002 pid=3722097)
+DETAIL:  This operation is not supported for indexes.
 CREATE SEQUENCE sequence_testx OWNED BY pg_class.relname;  -- not same schema
 ERROR:  sequence must be in same schema as table it is linked to
 CREATE TABLE sequence_test_table (a int);
diff --git a/contrib/pax_storage/src/test/regress/expected/stats.out 
b/contrib/pax_storage/src/test/regress/expected/stats.out
index a75f9801a36..f608a3ed6c0 100644
--- a/contrib/pax_storage/src/test/regress/expected/stats.out
+++ b/contrib/pax_storage/src/test/regress/expected/stats.out
@@ -210,7 +210,7 @@ SELECT pr.snap_ts < pg_stat_get_snapshot_timestamp() as 
snapshot_newer
 FROM prevstats AS pr;
  snapshot_newer 
 ----------------
- t
+ 
 (1 row)
 
 DROP TABLE trunc_stats_test, trunc_stats_test1, trunc_stats_test2, 
trunc_stats_test3, trunc_stats_test4;
diff --git a/contrib/pax_storage/src/test/regress/expected/subscription.out 
b/contrib/pax_storage/src/test/regress/expected/subscription.out
index e1bac50dfe4..ab9123a341d 100644
--- a/contrib/pax_storage/src/test/regress/expected/subscription.out
+++ b/contrib/pax_storage/src/test/regress/expected/subscription.out
@@ -28,7 +28,8 @@ CREATE SUBSCRIPTION regress_testsub CONNECTION 
'dbname=regress_doesnotexist' PUB
 ERROR:  publication name "foo" used more than once
 -- ok
 CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' 
PUBLICATION testpub WITH (connect = false);
-WARNING:  tables were not subscribed, you will have to run ALTER SUBSCRIPTION 
... REFRESH PUBLICATION to subscribe the tables
+WARNING:  subscription was created, but is not connected
+HINT:  To initiate replication, you must manually create the replication slot, 
enable the subscription, and refresh the subscription.
 COMMENT ON SUBSCRIPTION regress_testsub IS 'test subscription';
 SELECT obj_description(s.oid, 'pg_subscription') FROM pg_subscription s;
   obj_description  
@@ -42,7 +43,8 @@ ERROR:  subscription "regress_testsub" already exists
 -- fail - must be superuser
 SET SESSION AUTHORIZATION 'regress_subscription_user2';
 CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' 
PUBLICATION foo WITH (connect = false);
-ERROR:  must be superuser to create subscriptions
+ERROR:  permission denied to create subscription
+DETAIL:  Only roles with privileges of the "pg_create_subscription" role may 
create subscriptions.
 SET SESSION AUTHORIZATION 'regress_subscription_user';
 -- fail - invalid option combinations
 CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' 
PUBLICATION testpub WITH (connect = false, copy_data = true);
@@ -54,7 +56,7 @@ ERROR:  connect = false and create_slot = true are mutually 
exclusive options
 CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' 
PUBLICATION testpub WITH (slot_name = NONE, enabled = true);
 ERROR:  slot_name = NONE and enabled = true are mutually exclusive options
 CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' 
PUBLICATION testpub WITH (slot_name = NONE, create_slot = true);
-ERROR:  slot_name = NONE and create_slot = true are mutually exclusive options
+ERROR:  subscription with slot_name = NONE must also set enabled = false
 CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' 
PUBLICATION testpub WITH (slot_name = NONE);
 ERROR:  subscription with slot_name = NONE must also set enabled = false
 CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' 
PUBLICATION testpub WITH (slot_name = NONE, enabled = false);
@@ -63,7 +65,8 @@ CREATE SUBSCRIPTION regress_testsub2 CONNECTION 
'dbname=regress_doesnotexist' PU
 ERROR:  subscription with slot_name = NONE must also set enabled = false
 -- ok - with slot_name = NONE
 CREATE SUBSCRIPTION regress_testsub3 CONNECTION 'dbname=regress_doesnotexist' 
PUBLICATION testpub WITH (slot_name = NONE, connect = false);
-WARNING:  tables were not subscribed, you will have to run ALTER SUBSCRIPTION 
... REFRESH PUBLICATION to subscribe the tables
+WARNING:  subscription was created, but is not connected
+HINT:  To initiate replication, you must manually create the replication slot, 
enable the subscription, and refresh the subscription.
 -- fail
 ALTER SUBSCRIPTION regress_testsub3 ENABLE;
 ERROR:  cannot enable subscription that does not have a slot name
@@ -74,10 +77,10 @@ DROP SUBSCRIPTION regress_testsub3;
 ALTER SUBSCRIPTION regress_testsub CONNECTION 'foobar';
 ERROR:  invalid connection string syntax: missing "=" after "foobar" in 
connection info string
 \dRs+
-                                                            List of 
subscriptions
-      Name       |           Owner           | Enabled | Publication | Binary 
| Streaming | Synchronous commit |          Conninfo           
------------------+---------------------------+---------+-------------+--------+-----------+--------------------+-----------------------------
- regress_testsub | regress_subscription_user | f       | {testpub}   | f      
| f         | off                | dbname=regress_doesnotexist
+                                                                               
                            List of subscriptions
+      Name       |           Owner           | Enabled | Publication | Binary 
| Streaming | Two-phase commit | Disable on error | Origin | Password required 
| Run as owner? | Synchronous commit |          Conninfo           | Skip LSN 
+-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+--------------------+-----------------------------+----------
+ regress_testsub | regress_subscription_user | f       | {testpub}   | f      
| off       | d                | f                | any    | t                 
| f             | off                | dbname=regress_doesnotexist | 0/0
 (1 row)
 
 ALTER SUBSCRIPTION regress_testsub SET PUBLICATION testpub2, testpub3 WITH 
(refresh = false);
@@ -92,10 +95,10 @@ ERROR:  subscription "regress_doesnotexist" does not exist
 ALTER SUBSCRIPTION regress_testsub SET (create_slot = false);
 ERROR:  unrecognized subscription parameter: "create_slot"
 \dRs+
-                                                                List of 
subscriptions
-      Name       |           Owner           | Enabled |     Publication     | 
Binary | Streaming | Synchronous commit |           Conninfo           
------------------+---------------------------+---------+---------------------+--------+-----------+--------------------+------------------------------
- regress_testsub | regress_subscription_user | f       | {testpub2,testpub3} | 
f      | f         | off                | dbname=regress_doesnotexist2
+                                                                               
                                List of subscriptions
+      Name       |           Owner           | Enabled |     Publication     | 
Binary | Streaming | Two-phase commit | Disable on error | Origin | Password 
required | Run as owner? | Synchronous commit |           Conninfo           | 
Skip LSN 
+-----------------+---------------------------+---------+---------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+--------------------+------------------------------+----------
+ regress_testsub | regress_subscription_user | f       | {testpub2,testpub3} | 
f      | off       | d                | f                | any    | t           
      | f             | off                | dbname=regress_doesnotexist2 | 0/0
 (1 row)
 
 BEGIN;
@@ -127,18 +130,16 @@ ALTER SUBSCRIPTION regress_testsub_foo SET 
(synchronous_commit = foobar);
 ERROR:  invalid value for parameter "synchronous_commit": "foobar"
 HINT:  Available values: local, remote_write, remote_apply, on, off.
 \dRs+
-                                                                  List of 
subscriptions
-        Name         |           Owner           | Enabled |     Publication   
  | Binary | Streaming | Synchronous commit |           Conninfo           
----------------------+---------------------------+---------+---------------------+--------+-----------+--------------------+------------------------------
- regress_testsub_foo | regress_subscription_user | f       | 
{testpub2,testpub3} | f      | f         | local              | 
dbname=regress_doesnotexist2
+                                                                               
                                  List of subscriptions
+        Name         |           Owner           | Enabled |     Publication   
  | Binary | Streaming | Two-phase commit | Disable on error | Origin | 
Password required | Run as owner? | Synchronous commit |           Conninfo     
      | Skip LSN 
+---------------------+---------------------------+---------+---------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+--------------------+------------------------------+----------
+ regress_testsub_foo | regress_subscription_user | f       | 
{testpub2,testpub3} | f      | off       | d                | f                
| any    | t                 | f             | local              | 
dbname=regress_doesnotexist2 | 0/0
 (1 row)
 
 -- rename back to keep the rest simple
 ALTER SUBSCRIPTION regress_testsub_foo RENAME TO regress_testsub;
 -- fail - new owner must be superuser
 ALTER SUBSCRIPTION regress_testsub OWNER TO regress_subscription_user2;
-ERROR:  permission denied to change owner of subscription "regress_testsub"
-HINT:  The owner of a subscription must be a superuser.
 ALTER ROLE regress_subscription_user2 SUPERUSER;
 -- now it works
 ALTER SUBSCRIPTION regress_testsub OWNER TO regress_subscription_user2;
@@ -161,44 +162,46 @@ CREATE SUBSCRIPTION regress_testsub CONNECTION 
'dbname=regress_doesnotexist' PUB
 ERROR:  binary requires a Boolean value
 -- now it works
 CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' 
PUBLICATION testpub WITH (connect = false, binary = true);
-WARNING:  tables were not subscribed, you will have to run ALTER SUBSCRIPTION 
... REFRESH PUBLICATION to subscribe the tables
+WARNING:  subscription was created, but is not connected
+HINT:  To initiate replication, you must manually create the replication slot, 
enable the subscription, and refresh the subscription.
 \dRs+
-                                                            List of 
subscriptions
-      Name       |           Owner           | Enabled | Publication | Binary 
| Streaming | Synchronous commit |          Conninfo           
------------------+---------------------------+---------+-------------+--------+-----------+--------------------+-----------------------------
- regress_testsub | regress_subscription_user | f       | {testpub}   | t      
| f         | off                | dbname=regress_doesnotexist
+                                                                               
                            List of subscriptions
+      Name       |           Owner           | Enabled | Publication | Binary 
| Streaming | Two-phase commit | Disable on error | Origin | Password required 
| Run as owner? | Synchronous commit |          Conninfo           | Skip LSN 
+-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+--------------------+-----------------------------+----------
+ regress_testsub | regress_subscription_user | f       | {testpub}   | t      
| off       | d                | f                | any    | t                 
| f             | off                | dbname=regress_doesnotexist | 0/0
 (1 row)
 
 ALTER SUBSCRIPTION regress_testsub SET (binary = false);
 ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
 \dRs+
-                                                            List of 
subscriptions
-      Name       |           Owner           | Enabled | Publication | Binary 
| Streaming | Synchronous commit |          Conninfo           
------------------+---------------------------+---------+-------------+--------+-----------+--------------------+-----------------------------
- regress_testsub | regress_subscription_user | f       | {testpub}   | f      
| f         | off                | dbname=regress_doesnotexist
+                                                                               
                            List of subscriptions
+      Name       |           Owner           | Enabled | Publication | Binary 
| Streaming | Two-phase commit | Disable on error | Origin | Password required 
| Run as owner? | Synchronous commit |          Conninfo           | Skip LSN 
+-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+--------------------+-----------------------------+----------
+ regress_testsub | regress_subscription_user | f       | {testpub}   | f      
| off       | d                | f                | any    | t                 
| f             | off                | dbname=regress_doesnotexist | 0/0
 (1 row)
 
 DROP SUBSCRIPTION regress_testsub;
 -- fail - streaming must be boolean
 CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' 
PUBLICATION testpub WITH (connect = false, streaming = foo);
-ERROR:  streaming requires a Boolean value
+ERROR:  streaming requires a Boolean value or "parallel"
 -- now it works
 CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' 
PUBLICATION testpub WITH (connect = false, streaming = true);
-WARNING:  tables were not subscribed, you will have to run ALTER SUBSCRIPTION 
... REFRESH PUBLICATION to subscribe the tables
+WARNING:  subscription was created, but is not connected
+HINT:  To initiate replication, you must manually create the replication slot, 
enable the subscription, and refresh the subscription.
 \dRs+
-                                                            List of 
subscriptions
-      Name       |           Owner           | Enabled | Publication | Binary 
| Streaming | Synchronous commit |          Conninfo           
------------------+---------------------------+---------+-------------+--------+-----------+--------------------+-----------------------------
- regress_testsub | regress_subscription_user | f       | {testpub}   | f      
| t         | off                | dbname=regress_doesnotexist
+                                                                               
                            List of subscriptions
+      Name       |           Owner           | Enabled | Publication | Binary 
| Streaming | Two-phase commit | Disable on error | Origin | Password required 
| Run as owner? | Synchronous commit |          Conninfo           | Skip LSN 
+-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+--------------------+-----------------------------+----------
+ regress_testsub | regress_subscription_user | f       | {testpub}   | f      
| on        | d                | f                | any    | t                 
| f             | off                | dbname=regress_doesnotexist | 0/0
 (1 row)
 
 ALTER SUBSCRIPTION regress_testsub SET (streaming = false);
 ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
 \dRs+
-                                                            List of 
subscriptions
-      Name       |           Owner           | Enabled | Publication | Binary 
| Streaming | Synchronous commit |          Conninfo           
------------------+---------------------------+---------+-------------+--------+-----------+--------------------+-----------------------------
- regress_testsub | regress_subscription_user | f       | {testpub}   | f      
| f         | off                | dbname=regress_doesnotexist
+                                                                               
                            List of subscriptions
+      Name       |           Owner           | Enabled | Publication | Binary 
| Streaming | Two-phase commit | Disable on error | Origin | Password required 
| Run as owner? | Synchronous commit |          Conninfo           | Skip LSN 
+-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+--------------------+-----------------------------+----------
+ regress_testsub | regress_subscription_user | f       | {testpub}   | f      
| off       | d                | f                | any    | t                 
| f             | off                | dbname=regress_doesnotexist | 0/0
 (1 row)
 
 -- fail - publication already exists
@@ -213,10 +216,10 @@ ALTER SUBSCRIPTION regress_testsub ADD PUBLICATION 
testpub1, testpub2 WITH (refr
 ALTER SUBSCRIPTION regress_testsub ADD PUBLICATION testpub1, testpub2 WITH 
(refresh = false);
 ERROR:  publication "testpub1" is already in subscription "regress_testsub"
 \dRs+
-                                                                    List of 
subscriptions
-      Name       |           Owner           | Enabled |         Publication   
      | Binary | Streaming | Synchronous commit |          Conninfo           
------------------+---------------------------+---------+-----------------------------+--------+-----------+--------------------+-----------------------------
- regress_testsub | regress_subscription_user | f       | 
{testpub,testpub1,testpub2} | f      | f         | off                | 
dbname=regress_doesnotexist
+                                                                               
                                    List of subscriptions
+      Name       |           Owner           | Enabled |         Publication   
      | Binary | Streaming | Two-phase commit | Disable on error | Origin | 
Password required | Run as owner? | Synchronous commit |          Conninfo      
     | Skip LSN 
+-----------------+---------------------------+---------+-----------------------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+--------------------+-----------------------------+----------
+ regress_testsub | regress_subscription_user | f       | 
{testpub,testpub1,testpub2} | f      | off       | d                | f         
       | any    | t                 | f             | off                | 
dbname=regress_doesnotexist | 0/0
 (1 row)
 
 -- fail - publication used more then once
@@ -231,16 +234,17 @@ ERROR:  publication "testpub3" is not in subscription 
"regress_testsub"
 -- ok - delete publications
 ALTER SUBSCRIPTION regress_testsub DROP PUBLICATION testpub1, testpub2 WITH 
(refresh = false);
 \dRs+
-                                                            List of 
subscriptions
-      Name       |           Owner           | Enabled | Publication | Binary 
| Streaming | Synchronous commit |          Conninfo           
------------------+---------------------------+---------+-------------+--------+-----------+--------------------+-----------------------------
- regress_testsub | regress_subscription_user | f       | {testpub}   | f      
| f         | off                | dbname=regress_doesnotexist
+                                                                               
                            List of subscriptions
+      Name       |           Owner           | Enabled | Publication | Binary 
| Streaming | Two-phase commit | Disable on error | Origin | Password required 
| Run as owner? | Synchronous commit |          Conninfo           | Skip LSN 
+-----------------+---------------------------+---------+-------------+--------+-----------+------------------+------------------+--------+-------------------+---------------+--------------------+-----------------------------+----------
+ regress_testsub | regress_subscription_user | f       | {testpub}   | f      
| off       | d                | f                | any    | t                 
| f             | off                | dbname=regress_doesnotexist | 0/0
 (1 row)
 
 DROP SUBSCRIPTION regress_testsub;
 CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' 
PUBLICATION mypub
        WITH (connect = false, create_slot = false, copy_data = false);
-WARNING:  tables were not subscribed, you will have to run ALTER SUBSCRIPTION 
... REFRESH PUBLICATION to subscribe the tables
+WARNING:  subscription was created, but is not connected
+HINT:  To initiate replication, you must manually create the replication slot, 
enable the subscription, and refresh the subscription.
 ALTER SUBSCRIPTION regress_testsub ENABLE;
 -- fail - ALTER SUBSCRIPTION with refresh is not allowed in a transaction
 -- block or function
diff --git a/contrib/pax_storage/src/test/regress/expected/tsearch.out 
b/contrib/pax_storage/src/test/regress/expected/tsearch.out
index 20c0c0da72c..9bdac4f6465 100644
--- a/contrib/pax_storage/src/test/regress/expected/tsearch.out
+++ b/contrib/pax_storage/src/test/regress/expected/tsearch.out
@@ -1825,12 +1825,12 @@ Water, water, every where,
   Nor any drop to drink.
 S. T. Coleridge (1772-1834)
 ', phraseto_tsquery('english', 'painted Ocean'));
-              ts_headline              
----------------------------------------
- <b>painted</b> Ship                  +
-   Upon a <b>painted</b> <b>Ocean</b>.+
- Water, water, every where            +
-   And all the boards did shrink
+           ts_headline            
+----------------------------------
+ <b>painted</b> <b>Ocean</b>.    +
+ Water, water, every where       +
+   And all the boards did shrink;+
+ Water, water, every
 (1 row)
 
 SELECT ts_headline('english', '
@@ -1903,9 +1903,9 @@ SELECT ts_headline('simple', '1 2 3 1 3'::text, '1 & 3', 
'MaxWords=4, MinWords=1
 (1 row)
 
 SELECT ts_headline('simple', '1 2 3 1 3'::text, '1 <-> 3', 'MaxWords=4, 
MinWords=1');
-        ts_headline         
-----------------------------
- <b>3</b> <b>1</b> <b>3</b>
+    ts_headline    
+-------------------
+ <b>1</b> <b>3</b>
 (1 row)
 
 --Check if headline fragments work
diff --git a/contrib/pax_storage/src/test/regress/expected/tuplesort.out 
b/contrib/pax_storage/src/test/regress/expected/tuplesort.out
index 47b5a8ddb21..63fcb8be3d5 100644
--- a/contrib/pax_storage/src/test/regress/expected/tuplesort.out
+++ b/contrib/pax_storage/src/test/regress/expected/tuplesort.out
@@ -546,20 +546,22 @@ EXPLAIN (COSTS OFF) :qry;
                      ->  GroupAggregate
                            Group Key: a.col12
                            Filter: (count(*) > 1)
-                           ->  Merge Join
-                                 Merge Cond: (a.col12 = b.col12)
-                                 ->  Sort
-                                       Sort Key: a.col12 DESC
-                                       ->  Redistribute Motion 3:3  (slice2; 
segments: 3)
-                                             Hash Key: a.col12
-                                             ->  Seq Scan on test_mark_restore 
a
-                                 ->  Sort
-                                       Sort Key: b.col12 DESC
-                                       ->  Redistribute Motion 3:3  (slice3; 
segments: 3)
-                                             Hash Key: b.col12
-                                             ->  Seq Scan on test_mark_restore 
b
+                           ->  Sort
+                                 Sort Key: a.col12 DESC, a.col1
+                                 ->  Merge Join
+                                       Merge Cond: (a.col12 = b.col12)
+                                       ->  Sort
+                                             Sort Key: a.col12 DESC
+                                             ->  Redistribute Motion 3:3  
(slice2; segments: 3)
+                                                   Hash Key: a.col12
+                                                   ->  Seq Scan on 
test_mark_restore a
+                                       ->  Sort
+                                             Sort Key: b.col12 DESC
+                                             ->  Redistribute Motion 3:3  
(slice3; segments: 3)
+                                                   Hash Key: b.col12
+                                                   ->  Seq Scan on 
test_mark_restore b
  Optimizer: Postgres query optimizer
-(22 rows)
+(24 rows)
 
 :qry;
  col12 | count | count | count | count | count 
@@ -590,20 +592,22 @@ EXPLAIN (COSTS OFF) :qry;
                      ->  GroupAggregate
                            Group Key: a.col12
                            Filter: (count(*) > 1)
-                           ->  Merge Join
-                                 Merge Cond: (a.col12 = b.col12)
-                                 ->  Sort
-                                       Sort Key: a.col12 DESC
-                                       ->  Redistribute Motion 3:3  (slice2; 
segments: 3)
-                                             Hash Key: a.col12
-                                             ->  Seq Scan on test_mark_restore 
a
-                                 ->  Sort
-                                       Sort Key: b.col12 DESC
-                                       ->  Redistribute Motion 3:3  (slice3; 
segments: 3)
-                                             Hash Key: b.col12
-                                             ->  Seq Scan on test_mark_restore 
b
+                           ->  Sort
+                                 Sort Key: a.col12 DESC, a.col1
+                                 ->  Merge Join
+                                       Merge Cond: (a.col12 = b.col12)
+                                       ->  Sort
+                                             Sort Key: a.col12 DESC
+                                             ->  Redistribute Motion 3:3  
(slice2; segments: 3)
+                                                   Hash Key: a.col12
+                                                   ->  Seq Scan on 
test_mark_restore a
+                                       ->  Sort
+                                             Sort Key: b.col12 DESC
+                                             ->  Redistribute Motion 3:3  
(slice3; segments: 3)
+                                                   Hash Key: b.col12
+                                                   ->  Seq Scan on 
test_mark_restore b
  Optimizer: Postgres query optimizer
-(22 rows)
+(24 rows)
 
 :qry;
  col12 | count | count | count | count | count 
diff --git a/contrib/pax_storage/src/test/regress/expected/window.out 
b/contrib/pax_storage/src/test/regress/expected/window.out
index de7238b5f1d..5f8767b5a52 100644
--- a/contrib/pax_storage/src/test/regress/expected/window.out
+++ b/contrib/pax_storage/src/test/regress/expected/window.out
@@ -1211,10 +1211,10 @@ SELECT * FROM v_window;
 (10 rows)
 
 SELECT pg_get_viewdef('v_window');
-                                    pg_get_viewdef                             
        
----------------------------------------------------------------------------------------
-  SELECT i.i,                                                                  
       +
-     sum(i.i) OVER (ORDER BY i.i ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS 
sum_rows+
+                                  pg_get_viewdef                               
    
+-----------------------------------------------------------------------------------
+  SELECT i,                                                                    
   +
+     sum(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS 
sum_rows+
     FROM generate_series(1, 10) i(i);
 (1 row)
 
@@ -1238,10 +1238,10 @@ SELECT * FROM v_window;
 (10 rows)
 
 SELECT pg_get_viewdef('v_window');
-                                              pg_get_viewdef                   
                            
------------------------------------------------------------------------------------------------------------
-  SELECT i.i,                                                                  
                           +
-     sum(i.i) OVER (ORDER BY i.i ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING 
EXCLUDE CURRENT ROW) AS sum_rows+
+                                            pg_get_viewdef                     
                        
+-------------------------------------------------------------------------------------------------------
+  SELECT i,                                                                    
                       +
+     sum(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING EXCLUDE 
CURRENT ROW) AS sum_rows+
     FROM generate_series(1, 10) i(i);
 (1 row)
 
@@ -1264,10 +1264,10 @@ SELECT * FROM v_window;
 (10 rows)
 
 SELECT pg_get_viewdef('v_window');
-                                           pg_get_viewdef                      
                      
------------------------------------------------------------------------------------------------------
-  SELECT i.i,                                                                  
                     +
-     sum(i.i) OVER (ORDER BY i.i ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING 
EXCLUDE GROUP) AS sum_rows+
+                                         pg_get_viewdef                        
                  
+-------------------------------------------------------------------------------------------------
+  SELECT i,                                                                    
                 +
+     sum(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING EXCLUDE 
GROUP) AS sum_rows+
     FROM generate_series(1, 10) i(i);
 (1 row)
 
@@ -1290,10 +1290,10 @@ SELECT * FROM v_window;
 (10 rows)
 
 SELECT pg_get_viewdef('v_window');
-                                           pg_get_viewdef                      
                     
-----------------------------------------------------------------------------------------------------
-  SELECT i.i,                                                                  
                    +
-     sum(i.i) OVER (ORDER BY i.i ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING 
EXCLUDE TIES) AS sum_rows+
+                                         pg_get_viewdef                        
                 
+------------------------------------------------------------------------------------------------
+  SELECT i,                                                                    
                +
+     sum(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING EXCLUDE 
TIES) AS sum_rows+
     FROM generate_series(1, 10) i(i);
 (1 row)
 
@@ -1316,10 +1316,10 @@ SELECT * FROM v_window;
 (10 rows)
 
 SELECT pg_get_viewdef('v_window');
-                                    pg_get_viewdef                             
        
----------------------------------------------------------------------------------------
-  SELECT i.i,                                                                  
       +
-     sum(i.i) OVER (ORDER BY i.i ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS 
sum_rows+
+                                  pg_get_viewdef                               
    
+-----------------------------------------------------------------------------------
+  SELECT i,                                                                    
   +
+     sum(i) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS 
sum_rows+
     FROM generate_series(1, 10) i(i);
 (1 row)
 
@@ -1341,10 +1341,10 @@ SELECT * FROM v_window;
 (10 rows)
 
 SELECT pg_get_viewdef('v_window');
-                                     pg_get_viewdef                            
          
------------------------------------------------------------------------------------------
-  SELECT i.i,                                                                  
         +
-     sum(i.i) OVER (ORDER BY i.i GROUPS BETWEEN 1 PRECEDING AND 1 FOLLOWING) 
AS sum_rows+
+                                   pg_get_viewdef                              
      
+-------------------------------------------------------------------------------------
+  SELECT i,                                                                    
     +
+     sum(i) OVER (ORDER BY i GROUPS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS 
sum_rows+
     FROM generate_series(1, 10) i(i);
 (1 row)
 
@@ -1353,10 +1353,10 @@ CREATE TEMP VIEW v_window AS
        SELECT i, min(i) over (order by i range between '1 day' preceding and 
'10 days' following) as min_i
   FROM generate_series(now(), now()+'100 days'::interval, '1 hour') i;
 SELECT pg_get_viewdef('v_window');
-                                                      pg_get_viewdef           
                                            
----------------------------------------------------------------------------------------------------------------------------
-  SELECT i.i,                                                                  
                                           +
-     min(i.i) OVER (ORDER BY i.i RANGE BETWEEN '@ 1 day'::interval PRECEDING 
AND '@ 10 days'::interval FOLLOWING) AS min_i+
+                                                    pg_get_viewdef             
                                        
+-----------------------------------------------------------------------------------------------------------------------
+  SELECT i,                                                                    
                                       +
+     min(i) OVER (ORDER BY i RANGE BETWEEN '@ 1 day'::interval PRECEDING AND 
'@ 10 days'::interval FOLLOWING) AS min_i+
     FROM generate_series(now(), (now() + '@ 100 days'::interval), '@ 1 
hour'::interval) i(i);
 (1 row)
 
@@ -3259,11 +3259,15 @@ WHERE depname = 'sales' OR RANDOM() > 0.5;
                Partition By: empsalary.depname
                ->  Sort
                      Sort Key: empsalary.depname
-                     ->  WindowAgg
-                           Partition By: (((empsalary.depname)::text || 
'A'::text)), empsalary.depname
-                           ->  Sort
-                                 Sort Key: (((empsalary.depname)::text || 
'A'::text)), empsalary.depname
-                                 ->  Seq Scan on empsalary
+                     ->  Redistribute Motion 3:3  (slice2; segments: 3)
+                           Hash Key: empsalary.depname
+                           ->  WindowAgg
+                                 Partition By: (((empsalary.depname)::text || 
'A'::text)), empsalary.depname
+                                 ->  Sort
+                                       Sort Key: (((empsalary.depname)::text 
|| 'A'::text)), empsalary.depname
+                                       ->  Redistribute Motion 3:3  (slice3; 
segments: 3)
+                                             Hash Key: empsalary.depname, 
(((empsalary.depname)::text || 'A'::text))
+                                             ->  Seq Scan on empsalary
  Optimizer: Postgres query optimizer
 (14 rows)
 
@@ -3301,10 +3305,11 @@ SELECT
 FROM empsalary;
                             QUERY PLAN                             
 -------------------------------------------------------------------
- Gather Motion 3:1  (slice1; segments: 3)
-   ->  WindowAgg
-         Partition By: depname
-         Order By: salary, enroll_date
+ WindowAgg
+   Partition By: depname
+   Order By: salary, enroll_date
+   ->  Gather Motion 3:1  (slice1; segments: 3)
+         Merge Key: depname, salary, enroll_date
          ->  WindowAgg
                Partition By: depname
                Order By: salary, enroll_date, empno


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

Reply via email to