Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 1b9cd69

Browse files
committed
Add some tests to check the SQL functions of control file
As the recent commit 05d4cbf (reverted after as a448e49) has proved, there is zero coverage for the four SQL functions that can scan the control file data: - pg_control_checkpoint() - pg_control_init() - pg_control_recovery() - pg_control_system() This commit adds a minimal coverage for these functions, checking that their execution is able to complete. This would have been enough to catch the problems introduced in the commit mentioned above. More checks could be done for each individual fields, but it is unclear whether this would be better than the other checks in place in the backend code. Per discussion with Bharath Rupireddy. Discussion: https://postgr.es/m/Y1d2FZmQmyAhPSRG@paquier.xyz
1 parent c591300 commit 1b9cd69

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/test/regress/expected/misc_functions.out

+25
Original file line numberDiff line numberDiff line change
@@ -594,3 +594,28 @@ SELECT * FROM tenk1 a JOIN my_gen_series(1,10) g ON a.unique1 = g;
594594
Index Cond: (unique1 = g.g)
595595
(4 rows)
596596

597+
-- Test functions for control data
598+
SELECT count(*) > 0 AS ok FROM pg_control_checkpoint();
599+
ok
600+
----
601+
t
602+
(1 row)
603+
604+
SELECT count(*) > 0 AS ok FROM pg_control_init();
605+
ok
606+
----
607+
t
608+
(1 row)
609+
610+
SELECT count(*) > 0 AS ok FROM pg_control_recovery();
611+
ok
612+
----
613+
t
614+
(1 row)
615+
616+
SELECT count(*) > 0 AS ok FROM pg_control_system();
617+
ok
618+
----
619+
t
620+
(1 row)
621+

src/test/regress/sql/misc_functions.sql

+6
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,9 @@ SELECT * FROM tenk1 a JOIN my_gen_series(1,1000) g ON a.unique1 = g;
223223

224224
EXPLAIN (COSTS OFF)
225225
SELECT * FROM tenk1 a JOIN my_gen_series(1,10) g ON a.unique1 = g;
226+
227+
-- Test functions for control data
228+
SELECT count(*) > 0 AS ok FROM pg_control_checkpoint();
229+
SELECT count(*) > 0 AS ok FROM pg_control_init();
230+
SELECT count(*) > 0 AS ok FROM pg_control_recovery();
231+
SELECT count(*) > 0 AS ok FROM pg_control_system();

0 commit comments

Comments
 (0)