3 -- sanity check, if we don't have indices the test will take years to
4 -- complete. But skip TOAST relations (since they will have varying
5 -- names depending on the current OID counter) as well as temp tables
6 -- of other backends (to avoid timing-dependent behavior).
8 SELECT relname, relhasindex
9 FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = relnamespace
10 WHERE relkind = 'r' AND (nspname ~ '^pg_temp_') IS NOT TRUE
13 -------------------------+-------------
18 array_index_op_test | t
76 num_exp_power_10_ln | t
101 pg_foreign_data_wrapper | t
102 pg_foreign_server | t
136 sql_implementation_info | f
141 sql_sizing_profiles | f
157 -- another sanity check: every system catalog that has OIDs should have
158 -- a unique index on OID. This ensures that the OIDs will be unique,
159 -- even after the OID counter wraps around.
160 -- We exclude non-system tables from the check by looking at nspname.
162 SELECT relname, nspname
163 FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = relnamespace
165 AND ((nspname ~ '^pg_') IS NOT FALSE)
166 AND NOT EXISTS (SELECT 1 FROM pg_index i WHERE indrelid = c.oid
167 AND indkey[0] = -2 AND indnatts = 1 AND indisunique);