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

Commit f161802

Browse files
committed
Fix flag tests in src/test/modules/test_oat_hooks
In what must have been a copy'n paste mistake, all the flag tests use the same flag rather than a different flag each. The bug is not suprising, considering that it's dead code; add a minimal, testimonial line to cover it. This is all pretty inconsequential, because this is just example code, but it had better be correct. Discussion: https://postgr.es/m/20220712152059.fwli2majwgzdmh4r@alvherre.pgsql
1 parent 784cedd commit f161802

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

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

+12-1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ 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]
8585
NOTICE: in process utility: superuser finished CreateStmt
86+
CREATE INDEX regress_test_table_t_idx ON regress_test_table (t);
87+
NOTICE: in process utility: superuser attempting IndexStmt
88+
NOTICE: in object access: superuser attempting create (subId=0x0) [explicit]
89+
NOTICE: in object access: superuser finished create (subId=0x0) [explicit]
90+
NOTICE: in process utility: superuser finished IndexStmt
8691
GRANT SELECT ON Table regress_test_table TO public;
8792
NOTICE: in process utility: superuser attempting GrantStmt
8893
NOTICE: in process utility: superuser finished GrantStmt
@@ -280,12 +285,18 @@ NOTICE: in process utility: superuser attempting alter system
280285
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x2000, alter system) [work_mem]
281286
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x2000, alter system) [work_mem]
282287
NOTICE: in process utility: superuser finished alter system
283-
-- Clean up
288+
-- try labelled drops
284289
RESET SESSION AUTHORIZATION;
285290
NOTICE: in process utility: superuser attempting set
286291
NOTICE: in object_access_hook_str: superuser attempting alter (subId=0x1000, set) [session_authorization]
287292
NOTICE: in object_access_hook_str: superuser finished alter (subId=0x1000, set) [session_authorization]
288293
NOTICE: in process utility: superuser finished set
294+
DROP INDEX CONCURRENTLY regress_test_table_t_idx;
295+
NOTICE: in process utility: superuser attempting DropStmt
296+
NOTICE: in object access: superuser attempting drop (subId=0x0) [concurrent drop,]
297+
NOTICE: in object access: superuser finished drop (subId=0x0) [concurrent drop,]
298+
NOTICE: in process utility: superuser finished DropStmt
299+
-- Clean up
289300
SET test_oat_hooks.audit = false;
290301
NOTICE: in process utility: superuser attempting set
291302
DROP ROLE regress_role_joe; -- fails

src/test/modules/test_oat_hooks/sql/test_oat_hooks.sql

+4-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ REVOKE ALL ON PARAMETER "none.such" FROM PUBLIC;
3838
-- Create objects for use in the test
3939
CREATE USER regress_test_user;
4040
CREATE TABLE regress_test_table (t text);
41+
CREATE INDEX regress_test_table_t_idx ON regress_test_table (t);
4142
GRANT SELECT ON Table regress_test_table TO public;
4243
CREATE FUNCTION regress_test_func (t text) RETURNS text AS $$
4344
SELECT $1;
@@ -88,9 +89,11 @@ RESET work_mem;
8889
ALTER SYSTEM SET work_mem = 8192;
8990
ALTER SYSTEM RESET work_mem;
9091

91-
-- Clean up
92+
-- try labelled drops
9293
RESET SESSION AUTHORIZATION;
94+
DROP INDEX CONCURRENTLY regress_test_table_t_idx;
9395

96+
-- Clean up
9497
SET test_oat_hooks.audit = false;
9598
DROP ROLE regress_role_joe; -- fails
9699
REVOKE ALL PRIVILEGES ON PARAMETER

src/test/modules/test_oat_hooks/test_oat_hooks.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -1795,15 +1795,15 @@ accesstype_arg_to_string(ObjectAccessType access, void *arg)
17951795
return psprintf("%s%s%s%s%s%s",
17961796
((drop_arg->dropflags & PERFORM_DELETION_INTERNAL)
17971797
? "internal action," : ""),
1798-
((drop_arg->dropflags & PERFORM_DELETION_INTERNAL)
1798+
((drop_arg->dropflags & PERFORM_DELETION_CONCURRENTLY)
17991799
? "concurrent drop," : ""),
1800-
((drop_arg->dropflags & PERFORM_DELETION_INTERNAL)
1800+
((drop_arg->dropflags & PERFORM_DELETION_QUIETLY)
18011801
? "suppress notices," : ""),
1802-
((drop_arg->dropflags & PERFORM_DELETION_INTERNAL)
1802+
((drop_arg->dropflags & PERFORM_DELETION_SKIP_ORIGINAL)
18031803
? "keep original object," : ""),
1804-
((drop_arg->dropflags & PERFORM_DELETION_INTERNAL)
1804+
((drop_arg->dropflags & PERFORM_DELETION_SKIP_EXTENSIONS)
18051805
? "keep extensions," : ""),
1806-
((drop_arg->dropflags & PERFORM_DELETION_INTERNAL)
1806+
((drop_arg->dropflags & PERFORM_DELETION_CONCURRENT_LOCK)
18071807
? "normal concurrent drop," : ""));
18081808
}
18091809
break;

0 commit comments

Comments
 (0)