File tree Expand file tree Collapse file tree 2 files changed +142
-72
lines changed Expand file tree Collapse file tree 2 files changed +142
-72
lines changed Original file line number Diff line number Diff line change 1
1
VACUUM;
2
2
--
3
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.
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).
6
7
--
7
8
SELECT relname, relhasindex
8
- FROM pg_class
9
- WHERE relhasindex AND relkind != 't'
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
10
11
ORDER BY relname;
11
- relname | relhasindex
12
- ---------------------+-------------
13
- array_index_op_test | t
14
- bt_f8_heap | t
15
- bt_i4_heap | t
16
- bt_name_heap | t
17
- bt_txt_heap | t
18
- circle_tbl | t
19
- fast_emp4000 | t
20
- func_index_heap | t
21
- hash_f8_heap | t
22
- hash_i4_heap | t
23
- hash_name_heap | t
24
- hash_txt_heap | t
25
- ihighway | t
26
- inhx | t
27
- num_exp_add | t
28
- num_exp_div | t
29
- num_exp_ln | t
30
- num_exp_log10 | t
31
- num_exp_mul | t
32
- num_exp_power_10_ln | t
33
- num_exp_sqrt | t
34
- num_exp_sub | t
35
- onek | t
36
- onek2 | t
37
- pg_aggregate | t
38
- pg_am | t
39
- pg_amop | t
40
- pg_amproc | t
41
- pg_attrdef | t
42
- pg_attribute | t
43
- pg_auth_members | t
44
- pg_authid | t
45
- pg_autovacuum | t
46
- pg_cast | t
47
- pg_class | t
48
- pg_constraint | t
49
- pg_conversion | t
50
- pg_database | t
51
- pg_depend | t
52
- pg_description | t
53
- pg_index | t
54
- pg_inherits | t
55
- pg_language | t
56
- pg_largeobject | t
57
- pg_namespace | t
58
- pg_opclass | t
59
- pg_operator | t
60
- pg_pltemplate | t
61
- pg_proc | t
62
- pg_rewrite | t
63
- pg_shdepend | t
64
- pg_shdescription | t
65
- pg_statistic | t
66
- pg_tablespace | t
67
- pg_trigger | t
68
- pg_type | t
69
- polygon_tbl | t
70
- road | t
71
- shighway | t
72
- tenk1 | t
73
- tenk2 | t
74
- (61 rows)
12
+ relname | relhasindex
13
+ -------------------------+-------------
14
+ a | f
15
+ a_star | f
16
+ abstime_tbl | f
17
+ aggtest | f
18
+ array_index_op_test | t
19
+ array_op_test | f
20
+ b | f
21
+ b_star | f
22
+ box_tbl | f
23
+ bprime | f
24
+ bt_f8_heap | t
25
+ bt_i4_heap | t
26
+ bt_name_heap | t
27
+ bt_txt_heap | t
28
+ c | f
29
+ c_star | f
30
+ char_tbl | f
31
+ check2_tbl | f
32
+ check_tbl | f
33
+ circle_tbl | t
34
+ city | f
35
+ copy_tbl | f
36
+ d | f
37
+ d_star | f
38
+ date_tbl | f
39
+ default_tbl | f
40
+ defaultexpr_tbl | f
41
+ dept | f
42
+ e_star | f
43
+ emp | f
44
+ equipment_r | f
45
+ f_star | f
46
+ fast_emp4000 | t
47
+ float4_tbl | f
48
+ float8_tbl | f
49
+ func_index_heap | t
50
+ hash_f8_heap | t
51
+ hash_i4_heap | t
52
+ hash_name_heap | t
53
+ hash_txt_heap | t
54
+ hobbies_r | f
55
+ ihighway | t
56
+ inet_tbl | f
57
+ inhe | f
58
+ inhf | f
59
+ inhx | t
60
+ insert_tbl | f
61
+ int2_tbl | f
62
+ int4_tbl | f
63
+ int8_tbl | f
64
+ interval_tbl | f
65
+ iportaltest | f
66
+ log_table | f
67
+ lseg_tbl | f
68
+ main_table | f
69
+ num_data | f
70
+ num_exp_add | t
71
+ num_exp_div | t
72
+ num_exp_ln | t
73
+ num_exp_log10 | t
74
+ num_exp_mul | t
75
+ num_exp_power_10_ln | t
76
+ num_exp_sqrt | t
77
+ num_exp_sub | t
78
+ num_input_test | f
79
+ num_result | f
80
+ onek | t
81
+ onek2 | t
82
+ path_tbl | f
83
+ person | f
84
+ pg_aggregate | t
85
+ pg_am | t
86
+ pg_amop | t
87
+ pg_amproc | t
88
+ pg_attrdef | t
89
+ pg_attribute | t
90
+ pg_auth_members | t
91
+ pg_authid | t
92
+ pg_autovacuum | t
93
+ pg_cast | t
94
+ pg_class | t
95
+ pg_constraint | t
96
+ pg_conversion | t
97
+ pg_database | t
98
+ pg_depend | t
99
+ pg_description | t
100
+ pg_index | t
101
+ pg_inherits | t
102
+ pg_language | t
103
+ pg_largeobject | t
104
+ pg_listener | f
105
+ pg_namespace | t
106
+ pg_opclass | t
107
+ pg_operator | t
108
+ pg_pltemplate | t
109
+ pg_proc | t
110
+ pg_rewrite | t
111
+ pg_shdepend | t
112
+ pg_shdescription | t
113
+ pg_statistic | t
114
+ pg_tablespace | t
115
+ pg_trigger | t
116
+ pg_type | t
117
+ point_tbl | f
118
+ polygon_tbl | t
119
+ ramp | f
120
+ real_city | f
121
+ reltime_tbl | f
122
+ road | t
123
+ shighway | t
124
+ slow_emp4000 | f
125
+ sql_features | f
126
+ sql_implementation_info | f
127
+ sql_languages | f
128
+ sql_packages | f
129
+ sql_parts | f
130
+ sql_sizing | f
131
+ sql_sizing_profiles | f
132
+ stud_emp | f
133
+ student | f
134
+ tenk1 | t
135
+ tenk2 | t
136
+ text_tbl | f
137
+ time_tbl | f
138
+ timestamp_tbl | f
139
+ timestamptz_tbl | f
140
+ timetz_tbl | f
141
+ tinterval_tbl | f
142
+ varchar_tbl | f
143
+ (129 rows)
75
144
76
145
--
77
146
-- another sanity check: every system catalog that has OIDs should have
Original file line number Diff line number Diff line change @@ -2,12 +2,13 @@ VACUUM;
2
2
3
3
--
4
4
-- sanity check, if we don't have indices the test will take years to
5
- -- complete. But skip TOAST relations since they will have varying
6
- -- names depending on the current OID counter.
5
+ -- complete. But skip TOAST relations (since they will have varying
6
+ -- names depending on the current OID counter) as well as temp tables
7
+ -- of other backends (to avoid timing-dependent behavior).
7
8
--
8
9
SELECT relname, relhasindex
9
- FROM pg_class
10
- WHERE relhasindex AND relkind != ' t '
10
+ FROM pg_class c LEFT JOIN pg_namespace n ON n . oid = relnamespace
11
+ WHERE relkind = ' r ' AND (nspname ~ ' ^pg_temp_ ' ) IS NOT TRUE
11
12
ORDER BY relname;
12
13
13
14
--
You can’t perform that action at this time.
0 commit comments