|
| 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 | +select count(*) >= 0 as ok from pg_available_extension_versions; |
| 11 | + ok |
| 12 | +---- |
| 13 | + t |
| 14 | +(1 row) |
| 15 | + |
| 16 | +select count(*) >= 0 as ok from pg_available_extensions; |
| 17 | + ok |
| 18 | +---- |
| 19 | + t |
| 20 | +(1 row) |
| 21 | + |
| 22 | +-- At introduction, pg_config had 23 entries; it may grow |
| 23 | +select count(*) > 20 as ok from pg_config; |
| 24 | + ok |
| 25 | +---- |
| 26 | + t |
| 27 | +(1 row) |
| 28 | + |
| 29 | +-- We expect no cursors in this test; see also portals.sql |
| 30 | +select count(*) = 0 as ok from pg_cursors; |
| 31 | + ok |
| 32 | +---- |
| 33 | + t |
| 34 | +(1 row) |
| 35 | + |
| 36 | +select count(*) >= 0 as ok from pg_file_settings; |
| 37 | + ok |
| 38 | +---- |
| 39 | + t |
| 40 | +(1 row) |
| 41 | + |
| 42 | +-- There will surely be at least one active lock |
| 43 | +select count(*) > 0 as ok from pg_locks; |
| 44 | + ok |
| 45 | +---- |
| 46 | + t |
| 47 | +(1 row) |
| 48 | + |
| 49 | +-- We expect no prepared statements in this test; see also prepare.sql |
| 50 | +select count(*) = 0 as ok from pg_prepared_statements; |
| 51 | + ok |
| 52 | +---- |
| 53 | + t |
| 54 | +(1 row) |
| 55 | + |
| 56 | +-- See also prepared_xacts.sql |
| 57 | +select count(*) >= 0 as ok from pg_prepared_xacts; |
| 58 | + ok |
| 59 | +---- |
| 60 | + t |
| 61 | +(1 row) |
| 62 | + |
| 63 | +-- This is to record the prevailing planner enable_foo settings during |
| 64 | +-- a regression test run. |
| 65 | +select name, setting from pg_settings where name like 'enable%'; |
| 66 | + name | setting |
| 67 | +----------------------+--------- |
| 68 | + enable_bitmapscan | on |
| 69 | + enable_hashagg | on |
| 70 | + enable_hashjoin | on |
| 71 | + enable_indexonlyscan | on |
| 72 | + enable_indexscan | on |
| 73 | + enable_material | on |
| 74 | + enable_mergejoin | on |
| 75 | + enable_nestloop | on |
| 76 | + enable_seqscan | on |
| 77 | + enable_sort | on |
| 78 | + enable_tidscan | on |
| 79 | +(11 rows) |
| 80 | + |
| 81 | +-- Test that the pg_timezone_names and pg_timezone_abbrevs views are |
| 82 | +-- more-or-less working. We can't test their contents in any great detail |
| 83 | +-- without the outputs changing anytime IANA updates the underlying data, |
| 84 | +-- but it seems reasonable to expect at least one entry per major meridian. |
| 85 | +-- (At the time of writing, the actual counts are around 38 because of |
| 86 | +-- zones using fractional GMT offsets, so this is a pretty loose test.) |
| 87 | +select count(distinct utc_offset) >= 24 as ok from pg_timezone_names; |
| 88 | + ok |
| 89 | +---- |
| 90 | + t |
| 91 | +(1 row) |
| 92 | + |
| 93 | +select count(distinct utc_offset) >= 24 as ok from pg_timezone_abbrevs; |
| 94 | + ok |
| 95 | +---- |
| 96 | + t |
| 97 | +(1 row) |
| 98 | + |
| 99 | +-- Let's check the non-default timezone abbreviation sets, too |
| 100 | +set timezone_abbreviations = 'Australia'; |
| 101 | +select count(distinct utc_offset) >= 24 as ok from pg_timezone_abbrevs; |
| 102 | + ok |
| 103 | +---- |
| 104 | + t |
| 105 | +(1 row) |
| 106 | + |
| 107 | +set timezone_abbreviations = 'India'; |
| 108 | +select count(distinct utc_offset) >= 24 as ok from pg_timezone_abbrevs; |
| 109 | + ok |
| 110 | +---- |
| 111 | + t |
| 112 | +(1 row) |
| 113 | + |