Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3451a57

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/843818.1659218928@sss.pgh.pa.us
1 parent 7781f4e commit 3451a57

File tree

2 files changed

+85
-1402
lines changed

2 files changed

+85
-1402
lines changed

src/test/modules/test_oat_hooks/expected/test_oat_hooks.out

+84-84
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,25 +82,25 @@ 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
CREATE INDEX regress_test_table_t_idx ON regress_test_table (t);
87-
NOTICE: in process utility: superuser attempting IndexStmt
87+
NOTICE: in process utility: superuser attempting CREATE INDEX
8888
NOTICE: in object access: superuser attempting create (subId=0x0) [explicit]
8989
NOTICE: in object access: superuser finished create (subId=0x0) [explicit]
90-
NOTICE: in process utility: superuser finished IndexStmt
90+
NOTICE: in process utility: superuser finished CREATE INDEX
9191
GRANT SELECT ON Table regress_test_table TO public;
92-
NOTICE: in process utility: superuser attempting GrantStmt
93-
NOTICE: in process utility: superuser finished GrantStmt
92+
NOTICE: in process utility: superuser attempting GRANT
93+
NOTICE: in process utility: superuser finished GRANT
9494
CREATE FUNCTION regress_test_func (t text) RETURNS text AS $$
9595
SELECT $1;
9696
$$ LANGUAGE sql;
97-
NOTICE: in process utility: superuser attempting CreateFunctionStmt
97+
NOTICE: in process utility: superuser attempting CREATE FUNCTION
9898
NOTICE: in object access: superuser attempting create (subId=0x0) [explicit]
9999
NOTICE: in object access: superuser finished create (subId=0x0) [explicit]
100-
NOTICE: in process utility: superuser finished CreateFunctionStmt
100+
NOTICE: in process utility: superuser finished CREATE FUNCTION
101101
GRANT EXECUTE ON FUNCTION regress_test_func (text) TO public;
102-
NOTICE: in process utility: superuser attempting GrantStmt
103-
NOTICE: in process utility: superuser finished GrantStmt
102+
NOTICE: in process utility: superuser attempting GRANT
103+
NOTICE: in process utility: superuser finished GRANT
104104
-- Do a few things as superuser
105105
SELECT * FROM regress_test_table;
106106
NOTICE: in executor check perms: superuser attempting execute
@@ -118,31 +118,31 @@ NOTICE: in executor check perms: superuser finished execute
118118
(1 row)
119119

120120
SET work_mem = 8192;
121-
NOTICE: in process utility: superuser attempting set
121+
NOTICE: in process utility: superuser attempting SET
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 SET
125125
RESET work_mem;
126-
NOTICE: in process utility: superuser attempting set
126+
NOTICE: in process utility: superuser attempting RESET
127127
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x1000, set) [work_mem]
128128
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [work_mem]
129-
NOTICE: in process utility: superuser finished set
129+
NOTICE: in process utility: superuser finished RESET
130130
ALTER SYSTEM SET work_mem = 8192;
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
ALTER SYSTEM RESET work_mem;
136-
NOTICE: in process utility: superuser attempting alter system
136+
NOTICE: in process utility: superuser attempting ALTER SYSTEM
137137
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x2000, alter system) [work_mem]
138138
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x2000, alter system) [work_mem]
139-
NOTICE: in process utility: superuser finished alter system
139+
NOTICE: in process utility: superuser finished ALTER SYSTEM
140140
-- Do those same things as non-superuser
141141
SET SESSION AUTHORIZATION regress_test_user;
142-
NOTICE: in process utility: superuser attempting set
142+
NOTICE: in process utility: superuser attempting SET
143143
NOTICE: in object_access_hook_str: non-superuser attempting alter (subId=0x1000, set) [session_authorization]
144144
NOTICE: in object_access_hook_str: non-superuser finished alter (subId=0x1000, set) [session_authorization]
145-
NOTICE: in process utility: non-superuser finished set
145+
NOTICE: in process utility: non-superuser finished SET
146146
SELECT * FROM regress_test_table;
147147
NOTICE: in object access: non-superuser attempting namespace search (subId=0x0) [no report on violation, allowed]
148148
LINE 1: SELECT * FROM regress_test_table;
@@ -165,83 +165,83 @@ NOTICE: in executor check perms: non-superuser finished execute
165165
(1 row)
166166

167167
SET work_mem = 8192;
168-
NOTICE: in process utility: non-superuser attempting set
168+
NOTICE: in process utility: non-superuser attempting SET
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 SET
172172
RESET work_mem;
173-
NOTICE: in process utility: non-superuser attempting set
173+
NOTICE: in process utility: non-superuser attempting RESET
174174
NOTICE: in object_access_hook_str: non-superuser attempting alter (subId=0x1000, set) [work_mem]
175175
NOTICE: in object_access_hook_str: non-superuser finished alter (subId=0x1000, set) [work_mem]
176-
NOTICE: in process utility: non-superuser finished set
176+
NOTICE: in process utility: non-superuser finished RESET
177177
ALTER SYSTEM SET work_mem = 8192;
178-
NOTICE: in process utility: non-superuser attempting alter system
178+
NOTICE: in process utility: non-superuser attempting ALTER SYSTEM
179179
ERROR: permission denied to set parameter "work_mem"
180180
ALTER SYSTEM RESET work_mem;
181-
NOTICE: in process utility: non-superuser attempting alter system
181+
NOTICE: in process utility: non-superuser attempting ALTER SYSTEM
182182
ERROR: permission denied to set parameter "work_mem"
183183
SET test_oat_hooks.user_var1 = true;
184-
NOTICE: in process utility: non-superuser attempting set
184+
NOTICE: in process utility: non-superuser attempting SET
185185
NOTICE: in object_access_hook_str: non-superuser attempting alter (subId=0x1000, set) [test_oat_hooks.user_var1]
186186
NOTICE: in object_access_hook_str: non-superuser finished alter (subId=0x1000, set) [test_oat_hooks.user_var1]
187-
NOTICE: in process utility: non-superuser finished set
187+
NOTICE: in process utility: non-superuser finished SET
188188
SET test_oat_hooks.super_var1 = true;
189-
NOTICE: in process utility: non-superuser attempting set
189+
NOTICE: in process utility: non-superuser attempting SET
190190
ERROR: permission denied to set parameter "test_oat_hooks.super_var1"
191191
ALTER SYSTEM SET test_oat_hooks.user_var1 = true;
192-
NOTICE: in process utility: non-superuser attempting alter system
192+
NOTICE: in process utility: non-superuser attempting ALTER SYSTEM
193193
ERROR: permission denied to set parameter "test_oat_hooks.user_var1"
194194
ALTER SYSTEM SET test_oat_hooks.super_var1 = true;
195-
NOTICE: in process utility: non-superuser attempting alter system
195+
NOTICE: in process utility: non-superuser attempting ALTER SYSTEM
196196
ERROR: permission denied to set parameter "test_oat_hooks.super_var1"
197197
SET test_oat_hooks.user_var2 = true;
198-
NOTICE: in process utility: non-superuser attempting set
198+
NOTICE: in process utility: non-superuser attempting SET
199199
NOTICE: in object_access_hook_str: non-superuser attempting alter (subId=0x1000, set) [test_oat_hooks.user_var2]
200200
NOTICE: in object_access_hook_str: non-superuser finished alter (subId=0x1000, set) [test_oat_hooks.user_var2]
201-
NOTICE: in process utility: non-superuser finished set
201+
NOTICE: in process utility: non-superuser finished SET
202202
SET test_oat_hooks.super_var2 = true;
203-
NOTICE: in process utility: non-superuser attempting set
203+
NOTICE: in process utility: non-superuser attempting SET
204204
ERROR: permission denied to set parameter "test_oat_hooks.super_var2"
205205
ALTER SYSTEM SET test_oat_hooks.user_var2 = true;
206-
NOTICE: in process utility: non-superuser attempting alter system
206+
NOTICE: in process utility: non-superuser attempting ALTER SYSTEM
207207
ERROR: permission denied to set parameter "test_oat_hooks.user_var2"
208208
ALTER SYSTEM SET test_oat_hooks.super_var2 = true;
209-
NOTICE: in process utility: non-superuser attempting alter system
209+
NOTICE: in process utility: non-superuser attempting ALTER SYSTEM
210210
ERROR: permission denied to set parameter "test_oat_hooks.super_var2"
211211
RESET SESSION AUTHORIZATION;
212-
NOTICE: in process utility: non-superuser attempting set
212+
NOTICE: in process utility: non-superuser attempting RESET
213213
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x1000, set) [session_authorization]
214214
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [session_authorization]
215-
NOTICE: in process utility: superuser finished set
215+
NOTICE: in process utility: superuser finished RESET
216216
-- Turn off non-superuser permissions
217217
SET test_oat_hooks.deny_set_variable = 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_set_variable]
220220
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [test_oat_hooks.deny_set_variable]
221-
NOTICE: in process utility: superuser finished set
221+
NOTICE: in process utility: superuser finished SET
222222
SET test_oat_hooks.deny_alter_system = 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_alter_system]
225225
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [test_oat_hooks.deny_alter_system]
226-
NOTICE: in process utility: superuser finished set
226+
NOTICE: in process utility: superuser finished SET
227227
SET test_oat_hooks.deny_object_access = 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_object_access]
230230
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [test_oat_hooks.deny_object_access]
231-
NOTICE: in process utility: superuser finished set
231+
NOTICE: in process utility: superuser finished SET
232232
SET test_oat_hooks.deny_exec_perms = 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_exec_perms]
235235
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [test_oat_hooks.deny_exec_perms]
236-
NOTICE: in process utility: superuser finished set
236+
NOTICE: in process utility: superuser finished SET
237237
SET test_oat_hooks.deny_utility_commands = true;
238-
NOTICE: in process utility: superuser attempting set
238+
NOTICE: in process utility: superuser attempting SET
239239
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x1000, set) [test_oat_hooks.deny_utility_commands]
240240
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [test_oat_hooks.deny_utility_commands]
241-
NOTICE: in process utility: superuser finished set
241+
NOTICE: in process utility: superuser finished SET
242242
-- Try again as non-superuser with permissions denied
243243
SET SESSION AUTHORIZATION regress_test_user;
244-
NOTICE: in process utility: superuser attempting set
244+
NOTICE: in process utility: superuser attempting SET
245245
NOTICE: in object_access_hook_str: non-superuser attempting alter (subId=0x1000, set) [session_authorization]
246246
ERROR: permission denied: set session_authorization
247247
SELECT * FROM regress_test_table;
@@ -266,39 +266,39 @@ NOTICE: in executor check perms: superuser finished execute
266266
(1 row)
267267

268268
SET work_mem = 8192;
269-
NOTICE: in process utility: superuser attempting set
269+
NOTICE: in process utility: superuser attempting SET
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 SET
273273
RESET work_mem;
274-
NOTICE: in process utility: superuser attempting set
274+
NOTICE: in process utility: superuser attempting RESET
275275
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x1000, set) [work_mem]
276276
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [work_mem]
277-
NOTICE: in process utility: superuser finished set
277+
NOTICE: in process utility: superuser finished RESET
278278
ALTER SYSTEM SET work_mem = 8192;
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
ALTER SYSTEM RESET work_mem;
284-
NOTICE: in process utility: superuser attempting alter system
284+
NOTICE: in process utility: superuser attempting ALTER SYSTEM
285285
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x2000, alter system) [work_mem]
286286
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x2000, alter system) [work_mem]
287-
NOTICE: in process utility: superuser finished alter system
287+
NOTICE: in process utility: superuser finished ALTER SYSTEM
288288
-- try labelled drops
289289
RESET SESSION AUTHORIZATION;
290-
NOTICE: in process utility: superuser attempting set
290+
NOTICE: in process utility: superuser attempting RESET
291291
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x1000, set) [session_authorization]
292292
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [session_authorization]
293-
NOTICE: in process utility: superuser finished set
293+
NOTICE: in process utility: superuser finished RESET
294294
DROP INDEX CONCURRENTLY regress_test_table_t_idx;
295-
NOTICE: in process utility: superuser attempting DropStmt
295+
NOTICE: in process utility: superuser attempting DROP INDEX
296296
NOTICE: in object access: superuser attempting drop (subId=0x0) [concurrent drop,]
297297
NOTICE: in object access: superuser finished drop (subId=0x0) [concurrent drop,]
298-
NOTICE: in process utility: superuser finished DropStmt
298+
NOTICE: in process utility: superuser finished DROP INDEX
299299
-- Clean up
300300
SET test_oat_hooks.audit = false;
301-
NOTICE: in process utility: superuser attempting set
301+
NOTICE: in process utility: superuser attempting SET
302302
DROP ROLE regress_role_joe; -- fails
303303
ERROR: role "regress_role_joe" cannot be dropped because some objects depend on it
304304
DETAIL: privileges for parameter test_oat_hooks.user_var1

0 commit comments

Comments
 (0)