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
134 sql_implementation_info | f
139 sql_sizing_profiles | f
155 -- another sanity check: every system catalog that has OIDs should have
156 -- a unique index on OID. This ensures that the OIDs will be unique,
157 -- even after the OID counter wraps around.
158 -- We exclude non-system tables from the check by looking at nspname.
160 SELECT relname, nspname
161 FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = relnamespace
163 AND ((nspname ~ '^pg_') IS NOT FALSE)
164 AND NOT EXISTS (SELECT 1 FROM pg_index i WHERE indrelid = c.oid
165 AND indkey[0] = -2 AND indnatts = 1 AND indisunique);