Skip to content

Commit 6e37312

Browse files
committed
Remove test_oat_hooks.c's nodetag_to_string().
In the short time this function has existed, it's already proven to be a nontrivial maintenance burden, since it has to be updated whenever a node tag is added or removed. Although in principle we could now automate that, I see little justification for having such functionality here at all. The function is only being applied to utility statements, for which we already have infrastructure for obtaining string names. Moreover, that infrastructure produces already-familiar-to-users names, unlike nodetag_to_string(). So, remove this function and use the existing infrastructure instead. That saves over a thousand lines of largely-unreachable code. Back-patch to v15 where this code came in. Although it seems unlikely that v15's nodetag list will change anymore, we might as well keep the two branches looking and acting alike; otherwise back-patching any test-results changes in this area will be painful. Discussion: https://postgr.es/m/[email protected]
1 parent 9c9fc20 commit 6e37312

File tree

2 files changed

+81
-1407
lines changed

2 files changed

+81
-1407
lines changed

Diff for: src/test/modules/test_oat_hooks/expected/test_oat_hooks.out

+80-80
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,26 @@ LOAD 'test_oat_hooks';
1111
SET test_oat_hooks.audit = true;
1212
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x1000, set) [test_oat_hooks.audit]
1313
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [test_oat_hooks.audit]
14-
NOTICE: in process utility: superuser finished set
14+
NOTICE: in process utility: superuser finished SET
1515
-- Creating privileges on an existent custom GUC should create precisely the
1616
-- right privileges, not overly conservative ones.
1717
GRANT SET ON PARAMETER test_oat_hooks.user_var2 TO regress_role_joe;
18-
NOTICE: in process utility: superuser attempting GrantStmt
19-
NOTICE: in process utility: superuser finished GrantStmt
18+
NOTICE: in process utility: superuser attempting GRANT
19+
NOTICE: in process utility: superuser finished GRANT
2020
GRANT SET ON PARAMETER test_oat_hooks.super_var2 TO regress_role_joe;
21-
NOTICE: in process utility: superuser attempting GrantStmt
22-
NOTICE: in process utility: superuser finished GrantStmt
21+
NOTICE: in process utility: superuser attempting GRANT
22+
NOTICE: in process utility: superuser finished GRANT
2323
-- Granting multiple privileges on a parameter should be reported correctly to
2424
-- the OAT hook, but beware that WITH GRANT OPTION is not represented.
2525
GRANT SET, ALTER SYSTEM ON PARAMETER none.such TO regress_role_joe;
26-
NOTICE: in process utility: superuser attempting GrantStmt
27-
NOTICE: in process utility: superuser finished GrantStmt
26+
NOTICE: in process utility: superuser attempting GRANT
27+
NOTICE: in process utility: superuser finished GRANT
2828
GRANT SET, ALTER SYSTEM ON PARAMETER another.bogus TO regress_role_joe WITH GRANT OPTION;
29-
NOTICE: in process utility: superuser attempting GrantStmt
30-
NOTICE: in process utility: superuser finished GrantStmt
29+
NOTICE: in process utility: superuser attempting GRANT
30+
NOTICE: in process utility: superuser finished GRANT
3131
-- Check when the hooks fire relative to dependency based abort of a drop
3232
DROP ROLE regress_role_joe;
33-
NOTICE: in process utility: superuser attempting DropRoleStmt
33+
NOTICE: in process utility: superuser attempting DROP ROLE
3434
NOTICE: in object access: superuser attempting drop (subId=0x0) []
3535
NOTICE: in object access: superuser finished drop (subId=0x0) []
3636
ERROR: role "regress_role_joe" cannot be dropped because some objects depend on it
@@ -42,30 +42,30 @@ privileges for parameter none.such
4242
privileges for parameter another.bogus
4343
-- Check the behavior of the hooks relative to do-nothing grants and revokes
4444
GRANT SET ON PARAMETER maintenance_work_mem TO PUBLIC;
45-
NOTICE: in process utility: superuser attempting GrantStmt
46-
NOTICE: in process utility: superuser finished GrantStmt
45+
NOTICE: in process utility: superuser attempting GRANT
46+
NOTICE: in process utility: superuser finished GRANT
4747
REVOKE SET ON PARAMETER maintenance_work_mem FROM PUBLIC;
48-
NOTICE: in process utility: superuser attempting GrantStmt
49-
NOTICE: in process utility: superuser finished GrantStmt
48+
NOTICE: in process utility: superuser attempting REVOKE
49+
NOTICE: in process utility: superuser finished REVOKE
5050
REVOKE ALTER SYSTEM ON PARAMETER maintenance_work_mem FROM PUBLIC;
51-
NOTICE: in process utility: superuser attempting GrantStmt
52-
NOTICE: in process utility: superuser finished GrantStmt
51+
NOTICE: in process utility: superuser attempting REVOKE
52+
NOTICE: in process utility: superuser finished REVOKE
5353
-- Check the behavior of the hooks relative to unrecognized parameters
5454
GRANT ALL ON PARAMETER "none.such" TO PUBLIC;
55-
NOTICE: in process utility: superuser attempting GrantStmt
56-
NOTICE: in process utility: superuser finished GrantStmt
55+
NOTICE: in process utility: superuser attempting GRANT
56+
NOTICE: in process utility: superuser finished GRANT
5757
-- Check relative to an operation that causes the catalog entry to be deleted
5858
REVOKE ALL ON PARAMETER "none.such" FROM PUBLIC;
59-
NOTICE: in process utility: superuser attempting GrantStmt
60-
NOTICE: in process utility: superuser finished GrantStmt
59+
NOTICE: in process utility: superuser attempting REVOKE
60+
NOTICE: in process utility: superuser finished REVOKE
6161
-- Create objects for use in the test
6262
CREATE USER regress_test_user;
63-
NOTICE: in process utility: superuser attempting CreateRoleStmt
63+
NOTICE: in process utility: superuser attempting CREATE ROLE
6464
NOTICE: in object access: superuser attempting create (subId=0x0) [explicit]
6565
NOTICE: in object access: superuser finished create (subId=0x0) [explicit]
66-
NOTICE: in process utility: superuser finished CreateRoleStmt
66+
NOTICE: in process utility: superuser finished CREATE ROLE
6767
CREATE TABLE regress_test_table (t text);
68-
NOTICE: in process utility: superuser attempting CreateStmt
68+
NOTICE: in process utility: superuser attempting CREATE TABLE
6969
NOTICE: in object access: superuser attempting namespace search (subId=0x0) [no report on violation, allowed]
7070
LINE 1: CREATE TABLE regress_test_table (t text);
7171
^
@@ -82,20 +82,20 @@ NOTICE: in object access: superuser attempting create (subId=0x0) [internal]
8282
NOTICE: in object access: superuser finished create (subId=0x0) [internal]
8383
NOTICE: in object access: superuser attempting create (subId=0x0) [internal]
8484
NOTICE: in object access: superuser finished create (subId=0x0) [internal]
85-
NOTICE: in process utility: superuser finished CreateStmt
85+
NOTICE: in process utility: superuser finished CREATE TABLE
8686
GRANT SELECT ON Table regress_test_table TO public;
87-
NOTICE: in process utility: superuser attempting GrantStmt
88-
NOTICE: in process utility: superuser finished GrantStmt
87+
NOTICE: in process utility: superuser attempting GRANT
88+
NOTICE: in process utility: superuser finished GRANT
8989
CREATE FUNCTION regress_test_func (t text) RETURNS text AS $$
9090
SELECT $1;
9191
$$ LANGUAGE sql;
92-
NOTICE: in process utility: superuser attempting CreateFunctionStmt
92+
NOTICE: in process utility: superuser attempting CREATE FUNCTION
9393
NOTICE: in object access: superuser attempting create (subId=0x0) [explicit]
9494
NOTICE: in object access: superuser finished create (subId=0x0) [explicit]
95-
NOTICE: in process utility: superuser finished CreateFunctionStmt
95+
NOTICE: in process utility: superuser finished CREATE FUNCTION
9696
GRANT EXECUTE ON FUNCTION regress_test_func (text) TO public;
97-
NOTICE: in process utility: superuser attempting GrantStmt
98-
NOTICE: in process utility: superuser finished GrantStmt
97+
NOTICE: in process utility: superuser attempting GRANT
98+
NOTICE: in process utility: superuser finished GRANT
9999
-- Do a few things as superuser
100100
SELECT * FROM regress_test_table;
101101
NOTICE: in executor check perms: superuser attempting execute
@@ -113,31 +113,31 @@ NOTICE: in executor check perms: superuser finished execute
113113
(1 row)
114114

115115
SET work_mem = 8192;
116-
NOTICE: in process utility: superuser attempting set
116+
NOTICE: in process utility: superuser attempting SET
117117
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x1000, set) [work_mem]
118118
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [work_mem]
119-
NOTICE: in process utility: superuser finished set
119+
NOTICE: in process utility: superuser finished SET
120120
RESET work_mem;
121-
NOTICE: in process utility: superuser attempting set
121+
NOTICE: in process utility: superuser attempting RESET
122122
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x1000, set) [work_mem]
123123
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [work_mem]
124-
NOTICE: in process utility: superuser finished set
124+
NOTICE: in process utility: superuser finished RESET
125125
ALTER SYSTEM SET work_mem = 8192;
126-
NOTICE: in process utility: superuser attempting alter system
126+
NOTICE: in process utility: superuser attempting ALTER SYSTEM
127127
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x2000, alter system) [work_mem]
128128
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x2000, alter system) [work_mem]
129-
NOTICE: in process utility: superuser finished alter system
129+
NOTICE: in process utility: superuser finished ALTER SYSTEM
130130
ALTER SYSTEM RESET work_mem;
131-
NOTICE: in process utility: superuser attempting alter system
131+
NOTICE: in process utility: superuser attempting ALTER SYSTEM
132132
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x2000, alter system) [work_mem]
133133
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x2000, alter system) [work_mem]
134-
NOTICE: in process utility: superuser finished alter system
134+
NOTICE: in process utility: superuser finished ALTER SYSTEM
135135
-- Do those same things as non-superuser
136136
SET SESSION AUTHORIZATION regress_test_user;
137-
NOTICE: in process utility: superuser attempting set
137+
NOTICE: in process utility: superuser attempting SET
138138
NOTICE: in object_access_hook_str: non-superuser attempting alter (subId=0x1000, set) [session_authorization]
139139
NOTICE: in object_access_hook_str: non-superuser finished alter (subId=0x1000, set) [session_authorization]
140-
NOTICE: in process utility: non-superuser finished set
140+
NOTICE: in process utility: non-superuser finished SET
141141
SELECT * FROM regress_test_table;
142142
NOTICE: in object access: non-superuser attempting namespace search (subId=0x0) [no report on violation, allowed]
143143
LINE 1: SELECT * FROM regress_test_table;
@@ -160,83 +160,83 @@ NOTICE: in executor check perms: non-superuser finished execute
160160
(1 row)
161161

162162
SET work_mem = 8192;
163-
NOTICE: in process utility: non-superuser attempting set
163+
NOTICE: in process utility: non-superuser attempting SET
164164
NOTICE: in object_access_hook_str: non-superuser attempting alter (subId=0x1000, set) [work_mem]
165165
NOTICE: in object_access_hook_str: non-superuser finished alter (subId=0x1000, set) [work_mem]
166-
NOTICE: in process utility: non-superuser finished set
166+
NOTICE: in process utility: non-superuser finished SET
167167
RESET work_mem;
168-
NOTICE: in process utility: non-superuser attempting set
168+
NOTICE: in process utility: non-superuser attempting RESET
169169
NOTICE: in object_access_hook_str: non-superuser attempting alter (subId=0x1000, set) [work_mem]
170170
NOTICE: in object_access_hook_str: non-superuser finished alter (subId=0x1000, set) [work_mem]
171-
NOTICE: in process utility: non-superuser finished set
171+
NOTICE: in process utility: non-superuser finished RESET
172172
ALTER SYSTEM SET work_mem = 8192;
173-
NOTICE: in process utility: non-superuser attempting alter system
173+
NOTICE: in process utility: non-superuser attempting ALTER SYSTEM
174174
ERROR: permission denied to set parameter "work_mem"
175175
ALTER SYSTEM RESET work_mem;
176-
NOTICE: in process utility: non-superuser attempting alter system
176+
NOTICE: in process utility: non-superuser attempting ALTER SYSTEM
177177
ERROR: permission denied to set parameter "work_mem"
178178
SET test_oat_hooks.user_var1 = true;
179-
NOTICE: in process utility: non-superuser attempting set
179+
NOTICE: in process utility: non-superuser attempting SET
180180
NOTICE: in object_access_hook_str: non-superuser attempting alter (subId=0x1000, set) [test_oat_hooks.user_var1]
181181
NOTICE: in object_access_hook_str: non-superuser finished alter (subId=0x1000, set) [test_oat_hooks.user_var1]
182-
NOTICE: in process utility: non-superuser finished set
182+
NOTICE: in process utility: non-superuser finished SET
183183
SET test_oat_hooks.super_var1 = true;
184-
NOTICE: in process utility: non-superuser attempting set
184+
NOTICE: in process utility: non-superuser attempting SET
185185
ERROR: permission denied to set parameter "test_oat_hooks.super_var1"
186186
ALTER SYSTEM SET test_oat_hooks.user_var1 = true;
187-
NOTICE: in process utility: non-superuser attempting alter system
187+
NOTICE: in process utility: non-superuser attempting ALTER SYSTEM
188188
ERROR: permission denied to set parameter "test_oat_hooks.user_var1"
189189
ALTER SYSTEM SET test_oat_hooks.super_var1 = true;
190-
NOTICE: in process utility: non-superuser attempting alter system
190+
NOTICE: in process utility: non-superuser attempting ALTER SYSTEM
191191
ERROR: permission denied to set parameter "test_oat_hooks.super_var1"
192192
SET test_oat_hooks.user_var2 = true;
193-
NOTICE: in process utility: non-superuser attempting set
193+
NOTICE: in process utility: non-superuser attempting SET
194194
NOTICE: in object_access_hook_str: non-superuser attempting alter (subId=0x1000, set) [test_oat_hooks.user_var2]
195195
NOTICE: in object_access_hook_str: non-superuser finished alter (subId=0x1000, set) [test_oat_hooks.user_var2]
196-
NOTICE: in process utility: non-superuser finished set
196+
NOTICE: in process utility: non-superuser finished SET
197197
SET test_oat_hooks.super_var2 = true;
198-
NOTICE: in process utility: non-superuser attempting set
198+
NOTICE: in process utility: non-superuser attempting SET
199199
ERROR: permission denied to set parameter "test_oat_hooks.super_var2"
200200
ALTER SYSTEM SET test_oat_hooks.user_var2 = true;
201-
NOTICE: in process utility: non-superuser attempting alter system
201+
NOTICE: in process utility: non-superuser attempting ALTER SYSTEM
202202
ERROR: permission denied to set parameter "test_oat_hooks.user_var2"
203203
ALTER SYSTEM SET test_oat_hooks.super_var2 = true;
204-
NOTICE: in process utility: non-superuser attempting alter system
204+
NOTICE: in process utility: non-superuser attempting ALTER SYSTEM
205205
ERROR: permission denied to set parameter "test_oat_hooks.super_var2"
206206
RESET SESSION AUTHORIZATION;
207-
NOTICE: in process utility: non-superuser attempting set
207+
NOTICE: in process utility: non-superuser attempting RESET
208208
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x1000, set) [session_authorization]
209209
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [session_authorization]
210-
NOTICE: in process utility: superuser finished set
210+
NOTICE: in process utility: superuser finished RESET
211211
-- Turn off non-superuser permissions
212212
SET test_oat_hooks.deny_set_variable = true;
213-
NOTICE: in process utility: superuser attempting set
213+
NOTICE: in process utility: superuser attempting SET
214214
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x1000, set) [test_oat_hooks.deny_set_variable]
215215
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [test_oat_hooks.deny_set_variable]
216-
NOTICE: in process utility: superuser finished set
216+
NOTICE: in process utility: superuser finished SET
217217
SET test_oat_hooks.deny_alter_system = true;
218-
NOTICE: in process utility: superuser attempting set
218+
NOTICE: in process utility: superuser attempting SET
219219
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x1000, set) [test_oat_hooks.deny_alter_system]
220220
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [test_oat_hooks.deny_alter_system]
221-
NOTICE: in process utility: superuser finished set
221+
NOTICE: in process utility: superuser finished SET
222222
SET test_oat_hooks.deny_object_access = true;
223-
NOTICE: in process utility: superuser attempting set
223+
NOTICE: in process utility: superuser attempting SET
224224
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x1000, set) [test_oat_hooks.deny_object_access]
225225
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [test_oat_hooks.deny_object_access]
226-
NOTICE: in process utility: superuser finished set
226+
NOTICE: in process utility: superuser finished SET
227227
SET test_oat_hooks.deny_exec_perms = true;
228-
NOTICE: in process utility: superuser attempting set
228+
NOTICE: in process utility: superuser attempting SET
229229
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x1000, set) [test_oat_hooks.deny_exec_perms]
230230
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [test_oat_hooks.deny_exec_perms]
231-
NOTICE: in process utility: superuser finished set
231+
NOTICE: in process utility: superuser finished SET
232232
SET test_oat_hooks.deny_utility_commands = true;
233-
NOTICE: in process utility: superuser attempting set
233+
NOTICE: in process utility: superuser attempting SET
234234
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x1000, set) [test_oat_hooks.deny_utility_commands]
235235
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [test_oat_hooks.deny_utility_commands]
236-
NOTICE: in process utility: superuser finished set
236+
NOTICE: in process utility: superuser finished SET
237237
-- Try again as non-superuser with permissions denied
238238
SET SESSION AUTHORIZATION regress_test_user;
239-
NOTICE: in process utility: superuser attempting set
239+
NOTICE: in process utility: superuser attempting SET
240240
NOTICE: in object_access_hook_str: non-superuser attempting alter (subId=0x1000, set) [session_authorization]
241241
ERROR: permission denied: set session_authorization
242242
SELECT * FROM regress_test_table;
@@ -261,33 +261,33 @@ NOTICE: in executor check perms: superuser finished execute
261261
(1 row)
262262

263263
SET work_mem = 8192;
264-
NOTICE: in process utility: superuser attempting set
264+
NOTICE: in process utility: superuser attempting SET
265265
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x1000, set) [work_mem]
266266
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [work_mem]
267-
NOTICE: in process utility: superuser finished set
267+
NOTICE: in process utility: superuser finished SET
268268
RESET work_mem;
269-
NOTICE: in process utility: superuser attempting set
269+
NOTICE: in process utility: superuser attempting RESET
270270
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x1000, set) [work_mem]
271271
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [work_mem]
272-
NOTICE: in process utility: superuser finished set
272+
NOTICE: in process utility: superuser finished RESET
273273
ALTER SYSTEM SET work_mem = 8192;
274-
NOTICE: in process utility: superuser attempting alter system
274+
NOTICE: in process utility: superuser attempting ALTER SYSTEM
275275
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x2000, alter system) [work_mem]
276276
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x2000, alter system) [work_mem]
277-
NOTICE: in process utility: superuser finished alter system
277+
NOTICE: in process utility: superuser finished ALTER SYSTEM
278278
ALTER SYSTEM RESET work_mem;
279-
NOTICE: in process utility: superuser attempting alter system
279+
NOTICE: in process utility: superuser attempting ALTER SYSTEM
280280
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x2000, alter system) [work_mem]
281281
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x2000, alter system) [work_mem]
282-
NOTICE: in process utility: superuser finished alter system
282+
NOTICE: in process utility: superuser finished ALTER SYSTEM
283283
-- Clean up
284284
RESET SESSION AUTHORIZATION;
285-
NOTICE: in process utility: superuser attempting set
285+
NOTICE: in process utility: superuser attempting RESET
286286
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x1000, set) [session_authorization]
287287
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [session_authorization]
288-
NOTICE: in process utility: superuser finished set
288+
NOTICE: in process utility: superuser finished RESET
289289
SET test_oat_hooks.audit = false;
290-
NOTICE: in process utility: superuser attempting set
290+
NOTICE: in process utility: superuser attempting SET
291291
DROP ROLE regress_role_joe; -- fails
292292
ERROR: role "regress_role_joe" cannot be dropped because some objects depend on it
293293
DETAIL: privileges for parameter test_oat_hooks.user_var1

0 commit comments

Comments
 (0)