From e66c68139e1232b29378bc715ce633acf92adbe2 Mon Sep 17 00:00:00 2001
From: jian he <jian.universality@gmail.com>
Date: Thu, 22 Aug 2024 09:22:27 +0800
Subject: [PATCH v6 3/4] refactor regression test

---
 .../vacuum_tables_and_db_statistics.out       | 30 +++++++++----------
 .../sql/vacuum_tables_and_db_statistics.sql   | 18 +++++------
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/test/regress/expected/vacuum_tables_and_db_statistics.out b/src/test/regress/expected/vacuum_tables_and_db_statistics.out
index f0537aac43..085aab0128 100644
--- a/src/test/regress/expected/vacuum_tables_and_db_statistics.out
+++ b/src/test/regress/expected/vacuum_tables_and_db_statistics.out
@@ -6,9 +6,9 @@
 -- number of frozen and visible pages removed by backend.
 -- Statistic wal_fpi is not displayed in this test because its behavior is unstable.
 --
-CREATE DATABASE statistic_vacuum_database;
-CREATE DATABASE statistic_vacuum_database1;
-\c statistic_vacuum_database;
+CREATE DATABASE regression_statistic_vacuum_db;
+CREATE DATABASE regression_statistic_vacuum_db1;
+\c regression_statistic_vacuum_db;
 -- conditio sine qua non
 SHOW track_counts;  -- must be on
  track_counts 
@@ -212,9 +212,9 @@ SELECT dbname,
 FROM
 pg_stat_vacuum_database
 WHERE dbname = current_database();
-          dbname           | db_blks_hit | total_blks_dirtied | total_blks_written | wal_records | wal_fpi | wal_bytes | user_time | total_time 
----------------------------+-------------+--------------------+--------------------+-------------+---------+-----------+-----------+------------
- statistic_vacuum_database | t           | t                  | t                  | t           | t       | t         | t         | t
+             dbname             | db_blks_hit | total_blks_dirtied | total_blks_written | wal_records | wal_fpi | wal_bytes | user_time | total_time 
+--------------------------------+-------------+--------------------+--------------------+-------------+---------+-----------+-----------+------------
+ regression_statistic_vacuum_db | t           | t                  | t                  | t           | t       | t         | t         | t
 (1 row)
 
 DROP TABLE vestat CASCADE;
@@ -230,7 +230,7 @@ INSERT INTO vestat SELECT x FROM generate_series(1,:sample_size) as x;
 ANALYZE vestat;
 UPDATE vestat SET x = 10001;
 VACUUM (PARALLEL 0, BUFFER_USAGE_LIMIT 128) vestat;
-\c statistic_vacuum_database1;
+\c regression_statistic_vacuum_db1;
 -- Now check vacuum statistics for postgres database from another database
 SELECT dbname,
        db_blks_hit > 0 AS db_blks_hit,
@@ -243,17 +243,17 @@ SELECT dbname,
        total_time > 0 AS total_time
 FROM
 pg_stat_vacuum_database
-WHERE dbname = 'statistic_vacuum_database';
-          dbname           | db_blks_hit | total_blks_dirtied | total_blks_written | wal_records | wal_fpi | wal_bytes | user_time | total_time 
----------------------------+-------------+--------------------+--------------------+-------------+---------+-----------+-----------+------------
- statistic_vacuum_database | t           | t                  | t                  | t           | t       | t         | t         | t
+WHERE dbname = 'regression_statistic_vacuum_db';
+             dbname             | db_blks_hit | total_blks_dirtied | total_blks_written | wal_records | wal_fpi | wal_bytes | user_time | total_time 
+--------------------------------+-------------+--------------------+--------------------+-------------+---------+-----------+-----------+------------
+ regression_statistic_vacuum_db | t           | t                  | t                  | t           | t       | t         | t         | t
 (1 row)
 
-\c statistic_vacuum_database
+\c regression_statistic_vacuum_db
 RESET vacuum_freeze_min_age;
 RESET vacuum_freeze_table_age;
 DROP TABLE vestat CASCADE;
-\c statistic_vacuum_database1;
+\c regression_statistic_vacuum_db1;
 SELECT count(*)
 FROM pg_database d
 CROSS JOIN pg_stat_vacuum_tables(d.oid, 0)
@@ -273,5 +273,5 @@ WHERE oid = 0; -- must be 0
 (1 row)
 
 \c postgres
-DROP DATABASE statistic_vacuum_database1;
-DROP DATABASE statistic_vacuum_database;
+DROP DATABASE regression_statistic_vacuum_db1;
+DROP DATABASE regression_statistic_vacuum_db;
diff --git a/src/test/regress/sql/vacuum_tables_and_db_statistics.sql b/src/test/regress/sql/vacuum_tables_and_db_statistics.sql
index 43cc8068b0..5abb1aa731 100644
--- a/src/test/regress/sql/vacuum_tables_and_db_statistics.sql
+++ b/src/test/regress/sql/vacuum_tables_and_db_statistics.sql
@@ -7,9 +7,9 @@
 -- Statistic wal_fpi is not displayed in this test because its behavior is unstable.
 --
 
-CREATE DATABASE statistic_vacuum_database;
-CREATE DATABASE statistic_vacuum_database1;
-\c statistic_vacuum_database;
+CREATE DATABASE regression_statistic_vacuum_db;
+CREATE DATABASE regression_statistic_vacuum_db1;
+\c regression_statistic_vacuum_db;
 
 -- conditio sine qua non
 SHOW track_counts;  -- must be on
@@ -184,7 +184,7 @@ ANALYZE vestat;
 UPDATE vestat SET x = 10001;
 VACUUM (PARALLEL 0, BUFFER_USAGE_LIMIT 128) vestat;
 
-\c statistic_vacuum_database1;
+\c regression_statistic_vacuum_db1;
 
 -- Now check vacuum statistics for postgres database from another database
 SELECT dbname,
@@ -198,15 +198,15 @@ SELECT dbname,
        total_time > 0 AS total_time
 FROM
 pg_stat_vacuum_database
-WHERE dbname = 'statistic_vacuum_database';
+WHERE dbname = 'regression_statistic_vacuum_db';
 
-\c statistic_vacuum_database
+\c regression_statistic_vacuum_db
 
 RESET vacuum_freeze_min_age;
 RESET vacuum_freeze_table_age;
 DROP TABLE vestat CASCADE;
 
-\c statistic_vacuum_database1;
+\c regression_statistic_vacuum_db1;
 SELECT count(*)
 FROM pg_database d
 CROSS JOIN pg_stat_vacuum_tables(d.oid, 0)
@@ -218,5 +218,5 @@ CROSS JOIN pg_stat_vacuum_database(0)
 WHERE oid = 0; -- must be 0
 
 \c postgres
-DROP DATABASE statistic_vacuum_database1;
-DROP DATABASE statistic_vacuum_database;
+DROP DATABASE regression_statistic_vacuum_db1;
+DROP DATABASE regression_statistic_vacuum_db;
-- 
2.34.1

