From c92eba894be3f4d6b238917e6174373f1404a0fc Mon Sep 17 00:00:00 2001
From: songjinzhou <tsinghualucky912@foxmail.com>
Date: Tue, 18 Feb 2025 19:02:36 +0800
Subject: [PATCH] Modify an incorrect regression test case in the group by key
 value elimination function

---
 src/test/regress/expected/aggregates.out | 2 ++
 src/test/regress/sql/aggregates.sql      | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/src/test/regress/expected/aggregates.out b/src/test/regress/expected/aggregates.out
index f2fb66388c..ca95ba1343 100644
--- a/src/test/regress/expected/aggregates.out
+++ b/src/test/regress/expected/aggregates.out
@@ -1472,6 +1472,7 @@ explain (costs off) select b,c from t3 group by b,c;
 -- When there are multiple supporting unique indexes and the GROUP BY contains
 -- columns to cover all of those, ensure we pick the index with the least
 -- number of columns so that we can remove more columns from the GROUP BY.
+create unique index t3_b_c_uidx on t3(b, c);
 explain (costs off) select a,b,c from t3 group by a,b,c;
       QUERY PLAN      
 ----------------------
@@ -1490,6 +1491,7 @@ explain (costs off) select a,b,c from t3 group by c,a,b;
    ->  Seq Scan on t3
 (3 rows)
 
+drop index t3_b_c_uidx;
 -- Ensure we don't use a partial index as proof of functional dependency
 drop index t3_c_uidx;
 create index t3_c_uidx on t3 (c) where c > 0;
diff --git a/src/test/regress/sql/aggregates.sql b/src/test/regress/sql/aggregates.sql
index 77168bcc74..8acd64d34e 100644
--- a/src/test/regress/sql/aggregates.sql
+++ b/src/test/regress/sql/aggregates.sql
@@ -520,12 +520,14 @@ explain (costs off) select b,c from t3 group by b,c;
 -- When there are multiple supporting unique indexes and the GROUP BY contains
 -- columns to cover all of those, ensure we pick the index with the least
 -- number of columns so that we can remove more columns from the GROUP BY.
+create unique index t3_b_c_uidx on t3(b, c);
 explain (costs off) select a,b,c from t3 group by a,b,c;
 
 -- As above but try ordering the columns differently to ensure we get the
 -- same result.
 explain (costs off) select a,b,c from t3 group by c,a,b;
 
+drop index t3_b_c_uidx;
 -- Ensure we don't use a partial index as proof of functional dependency
 drop index t3_c_uidx;
 create index t3_c_uidx on t3 (c) where c > 0;
-- 
2.34.1

