1VACUUM;
2--
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).
7--
8-- temporarily disable fancy output, so catalog changes create less diff noise
9\a\t
10SELECT relname, relhasindex
11   FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = relnamespace
12   WHERE relkind IN ('r', 'p') AND (nspname ~ '^pg_temp_') IS NOT TRUE
13   ORDER BY relname;
14a|f
15a_star|f
16aggtest|f
17array_index_op_test|t
18array_op_test|f
19b|f
20b_star|f
21bit_defaults|f
22box_tbl|f
23bprime|f
24bt_f8_heap|t
25bt_i4_heap|t
26bt_name_heap|t
27bt_txt_heap|t
28c|f
29c_star|f
30char_tbl|f
31check2_tbl|f
32check_tbl|f
33circle_tbl|t
34city|f
35copy_tbl|f
36d|f
37d_star|f
38date_tbl|f
39default_tbl|f
40defaultexpr_tbl|f
41delete_test_table|t
42dept|f
43dupindexcols|t
44e_star|f
45emp|f
46equipment_r|f
47extra_wide_table|f
48f_star|f
49fast_emp4000|t
50float4_tbl|f
51float8_tbl|f
52func_index_heap|t
53hash_f8_heap|t
54hash_i4_heap|t
55hash_name_heap|t
56hash_txt_heap|t
57hobbies_r|f
58ihighway|t
59inet_tbl|f
60inhf|f
61inhx|t
62insert_tbl|f
63int2_tbl|f
64int4_tbl|f
65int8_tbl|f
66interval_tbl|f
67invalid_check_con|f
68invalid_check_con_child|f
69iportaltest|f
70kd_point_tbl|t
71line_tbl|f
72log_table|f
73lseg_tbl|f
74main_table|f
75mlparted|f
76mlparted1|f
77mlparted11|f
78mlparted12|f
79mlparted2|f
80mlparted3|f
81mlparted4|f
82mlparted_def|f
83mlparted_def1|f
84mlparted_def2|f
85mlparted_defd|f
86money_data|f
87num_data|f
88num_exp_add|t
89num_exp_div|t
90num_exp_ln|t
91num_exp_log10|t
92num_exp_mul|t
93num_exp_power_10_ln|t
94num_exp_sqrt|t
95num_exp_sub|t
96num_input_test|f
97num_result|f
98numrange_test|t
99onek|t
100onek2|t
101path_tbl|f
102person|f
103persons|f
104persons2|t
105persons3|t
106pg_aggregate|t
107pg_am|t
108pg_amop|t
109pg_amproc|t
110pg_attrdef|t
111pg_attribute|t
112pg_auth_members|t
113pg_authid|t
114pg_cast|t
115pg_class|t
116pg_collation|t
117pg_constraint|t
118pg_conversion|t
119pg_database|t
120pg_db_role_setting|t
121pg_default_acl|t
122pg_depend|t
123pg_description|t
124pg_enum|t
125pg_event_trigger|t
126pg_extension|t
127pg_foreign_data_wrapper|t
128pg_foreign_server|t
129pg_foreign_table|t
130pg_index|t
131pg_inherits|t
132pg_init_privs|t
133pg_language|t
134pg_largeobject|t
135pg_largeobject_metadata|t
136pg_namespace|t
137pg_opclass|t
138pg_operator|t
139pg_opfamily|t
140pg_partitioned_table|t
141pg_pltemplate|t
142pg_policy|t
143pg_proc|t
144pg_publication|t
145pg_publication_rel|t
146pg_range|t
147pg_replication_origin|t
148pg_rewrite|t
149pg_seclabel|t
150pg_sequence|t
151pg_shdepend|t
152pg_shdescription|t
153pg_shseclabel|t
154pg_statistic|t
155pg_statistic_ext|t
156pg_subscription|t
157pg_subscription_rel|t
158pg_tablespace|t
159pg_transform|t
160pg_trigger|t
161pg_ts_config|t
162pg_ts_config_map|t
163pg_ts_dict|t
164pg_ts_parser|t
165pg_ts_template|t
166pg_type|t
167pg_user_mapping|t
168point_tbl|t
169polygon_tbl|t
170quad_box_tbl|t
171quad_point_tbl|t
172quad_poly_tbl|t
173quad_poly_tbl_ord_seq1|f
174quad_poly_tbl_ord_seq2|f
175radix_text_tbl|t
176ramp|f
177real_city|f
178road|t
179shighway|t
180slow_emp4000|f
181sql_features|f
182sql_implementation_info|f
183sql_languages|f
184sql_packages|f
185sql_parts|f
186sql_sizing|f
187sql_sizing_profiles|f
188stud_emp|f
189student|f
190tbl_include_box|t
191tbl_include_box_pk|f
192tbl_include_pk|t
193tbl_include_reg|t
194tbl_include_unique1|t
195tbl_include_unique2|f
196tenk1|t
197tenk2|t
198test_range_excl|t
199test_range_gist|t
200test_range_spgist|t
201test_tsvector|f
202testjsonb|f
203text_tbl|f
204textrange_test|t
205time_tbl|f
206timestamp_tbl|f
207timestamptz_tbl|f
208timetz_tbl|f
209trigger_parted|t
210trigger_parted_p1|t
211trigger_parted_p1_1|t
212trigger_parted_p2|t
213trigger_parted_p2_2|t
214varchar_tbl|f
215view_base_table|t
216-- restore normal output mode
217\a\t
218--
219-- another sanity check: every system catalog that has OIDs should have
220-- a unique index on OID.  This ensures that the OIDs will be unique,
221-- even after the OID counter wraps around.
222-- We exclude non-system tables from the check by looking at nspname.
223--
224SELECT relname, nspname
225FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = relnamespace
226WHERE relhasoids
227    AND ((nspname ~ '^pg_') IS NOT FALSE)
228    AND NOT EXISTS (SELECT 1 FROM pg_index i WHERE indrelid = c.oid
229                    AND indkey[0] = -2 AND indnatts = 1
230                    AND indisunique AND indimmediate);
231 relname | nspname
232---------+---------
233(0 rows)
234
235