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 41dept|f 42dupindexcols|t 43e_star|f 44emp|f 45equipment_r|f 46extra_wide_table|f 47f_star|f 48fast_emp4000|t 49float4_tbl|f 50float8_tbl|f 51func_index_heap|t 52hash_f8_heap|t 53hash_i4_heap|t 54hash_name_heap|t 55hash_txt_heap|t 56hobbies_r|f 57ihighway|t 58inet_tbl|f 59insert_tbl|f 60int2_tbl|f 61int4_tbl|f 62int8_tbl|f 63interval_tbl|f 64invalid_check_con|f 65invalid_check_con_child|f 66iportaltest|f 67kd_point_tbl|t 68line_tbl|f 69log_table|f 70lseg_tbl|f 71main_table|f 72mlparted|f 73mlparted1|f 74mlparted11|f 75mlparted12|f 76mlparted2|f 77mlparted3|f 78mlparted4|f 79mlparted_def|f 80mlparted_def1|f 81mlparted_def2|f 82mlparted_defd|f 83money_data|f 84num_data|f 85num_exp_add|t 86num_exp_div|t 87num_exp_ln|t 88num_exp_log10|t 89num_exp_mul|t 90num_exp_power_10_ln|t 91num_exp_sqrt|t 92num_exp_sub|t 93num_input_test|f 94num_result|f 95nummultirange_test|t 96numrange_test|t 97onek|t 98onek2|t 99path_tbl|f 100person|f 101persons|f 102persons2|t 103persons3|t 104pg_aggregate|t 105pg_am|t 106pg_amop|t 107pg_amproc|t 108pg_attrdef|t 109pg_attribute|t 110pg_auth_members|t 111pg_authid|t 112pg_cast|t 113pg_class|t 114pg_collation|t 115pg_constraint|t 116pg_conversion|t 117pg_database|t 118pg_db_role_setting|t 119pg_default_acl|t 120pg_depend|t 121pg_description|t 122pg_enum|t 123pg_event_trigger|t 124pg_extension|t 125pg_foreign_data_wrapper|t 126pg_foreign_server|t 127pg_foreign_table|t 128pg_index|t 129pg_inherits|t 130pg_init_privs|t 131pg_language|t 132pg_largeobject|t 133pg_largeobject_metadata|t 134pg_namespace|t 135pg_opclass|t 136pg_operator|t 137pg_opfamily|t 138pg_partitioned_table|t 139pg_policy|t 140pg_proc|t 141pg_publication|t 142pg_publication_rel|t 143pg_range|t 144pg_replication_origin|t 145pg_rewrite|t 146pg_seclabel|t 147pg_sequence|t 148pg_shdepend|t 149pg_shdescription|t 150pg_shseclabel|t 151pg_statistic|t 152pg_statistic_ext|t 153pg_statistic_ext_data|t 154pg_subscription|t 155pg_subscription_rel|t 156pg_tablespace|t 157pg_transform|t 158pg_trigger|t 159pg_ts_config|t 160pg_ts_config_map|t 161pg_ts_dict|t 162pg_ts_parser|t 163pg_ts_template|t 164pg_type|t 165pg_user_mapping|t 166point_tbl|t 167polygon_tbl|t 168quad_box_tbl|t 169quad_box_tbl_ord_seq1|f 170quad_box_tbl_ord_seq2|f 171quad_point_tbl|t 172quad_poly_tbl|t 173radix_text_tbl|t 174ramp|f 175real_city|f 176reservations|f 177road|t 178shighway|t 179slow_emp4000|f 180sql_features|f 181sql_implementation_info|f 182sql_parts|f 183sql_sizing|f 184stud_emp|f 185student|f 186tableam_parted_a_heap2|f 187tableam_parted_b_heap2|f 188tableam_parted_c_heap2|f 189tableam_parted_d_heap2|f 190tableam_parted_heap2|f 191tableam_tbl_heap2|f 192tableam_tblas_heap2|f 193tbl_include_box|t 194tbl_include_box_pk|f 195tbl_include_pk|t 196tbl_include_reg|t 197tbl_include_unique1|t 198tbl_include_unique2|f 199tenk1|t 200tenk2|t 201test_range_excl|t 202test_range_gist|t 203test_range_spgist|t 204test_tsvector|f 205testjsonb|f 206text_tbl|f 207textrange_test|t 208time_tbl|f 209timestamp_tbl|f 210timestamptz_tbl|f 211timetz_tbl|f 212tmp|f 213trigger_parted|t 214trigger_parted_p1|t 215trigger_parted_p1_1|t 216trigger_parted_p2|t 217trigger_parted_p2_2|t 218varchar_tbl|f 219view_base_table|t 220-- restore normal output mode 221\a\t 222-- 223-- another sanity check: every system catalog that has OIDs should have 224-- a unique index on OID. This ensures that the OIDs will be unique, 225-- even after the OID counter wraps around. 226-- We exclude non-system tables from the check by looking at nspname. 227-- 228SELECT relname, nspname 229 FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = relnamespace JOIN pg_attribute a ON (attrelid = c.oid AND attname = 'oid') 230 WHERE relkind = 'r' and c.oid < 16384 231 AND ((nspname ~ '^pg_') IS NOT FALSE) 232 AND NOT EXISTS (SELECT 1 FROM pg_index i WHERE indrelid = c.oid 233 AND indkey[0] = a.attnum AND indnatts = 1 234 AND indisunique AND indimmediate); 235 relname | nspname 236---------+--------- 237(0 rows) 238 239-- check that relations without storage don't have relfilenode 240SELECT relname, relkind 241 FROM pg_class 242 WHERE relkind IN ('v', 'c', 'f', 'p', 'I') 243 AND relfilenode <> 0; 244 relname | relkind 245---------+--------- 246(0 rows) 247 248