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
98 pg_db_role_setting | t
103 pg_foreign_data_wrapper | t
104 pg_foreign_server | t
109 pg_largeobject_metadata | t
139 sql_implementation_info | f
144 sql_sizing_profiles | f
160 -- another sanity check: every system catalog that has OIDs should have
161 -- a unique index on OID. This ensures that the OIDs will be unique,
162 -- even after the OID counter wraps around.
163 -- We exclude non-system tables from the check by looking at nspname.
165 SELECT relname, nspname
166 FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = relnamespace
168 AND ((nspname ~ '^pg_') IS NOT FALSE)
169 AND NOT EXISTS (SELECT 1 FROM pg_index i WHERE indrelid = c.oid
170 AND indkey[0] = -2 AND indnatts = 1
171 AND indisunique AND indimmediate);