1-- 2-- Test assorted system views 3-- 4-- This test is mainly meant to provide some code coverage for the 5-- set-returning functions that underlie certain system views. 6-- The output of most of these functions is very environment-dependent, 7-- so our ability to test with fixed expected output is pretty limited; 8-- but even a trivial check of count(*) will exercise the normal code path 9-- through the SRF. 10 11select count(*) >= 0 as ok from pg_available_extension_versions; 12 13select count(*) >= 0 as ok from pg_available_extensions; 14 15-- At introduction, pg_config had 23 entries; it may grow 16select count(*) > 20 as ok from pg_config; 17 18-- We expect no cursors in this test; see also portals.sql 19select count(*) = 0 as ok from pg_cursors; 20 21select count(*) >= 0 as ok from pg_file_settings; 22 23-- There will surely be at least one rule 24select count(*) > 0 as ok from pg_hba_file_rules; 25 26-- There will surely be at least one active lock 27select count(*) > 0 as ok from pg_locks; 28 29-- We expect no prepared statements in this test; see also prepare.sql 30select count(*) = 0 as ok from pg_prepared_statements; 31 32-- See also prepared_xacts.sql 33select count(*) >= 0 as ok from pg_prepared_xacts; 34 35-- This is to record the prevailing planner enable_foo settings during 36-- a regression test run. 37select name, setting from pg_settings where name like 'enable%'; 38 39-- Test that the pg_timezone_names and pg_timezone_abbrevs views are 40-- more-or-less working. We can't test their contents in any great detail 41-- without the outputs changing anytime IANA updates the underlying data, 42-- but it seems reasonable to expect at least one entry per major meridian. 43-- (At the time of writing, the actual counts are around 38 because of 44-- zones using fractional GMT offsets, so this is a pretty loose test.) 45select count(distinct utc_offset) >= 24 as ok from pg_timezone_names; 46select count(distinct utc_offset) >= 24 as ok from pg_timezone_abbrevs; 47-- Let's check the non-default timezone abbreviation sets, too 48set timezone_abbreviations = 'Australia'; 49select count(distinct utc_offset) >= 24 as ok from pg_timezone_abbrevs; 50set timezone_abbreviations = 'India'; 51select count(distinct utc_offset) >= 24 as ok from pg_timezone_abbrevs; 52