Fix flag tests in src/test/modules/test_oat_hooks
authorAlvaro Herrera <[email protected]>
Wed, 13 Jul 2022 09:57:25 +0000 (11:57 +0200)
committerAlvaro Herrera <[email protected]>
Wed, 13 Jul 2022 10:58:56 +0000 (12:58 +0200)
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[email protected]

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

index c9b6eb20d374dad906ee2b471ec0737ef7b8b1cb..30828a7da399800aa682c8943feacb6f9b9aa7cd 100644 (file)
@@ -83,6 +83,11 @@ NOTICE:  in object access: superuser finished create (subId=0x0) [internal]
 NOTICE:  in object access: superuser attempting create (subId=0x0) [internal]
 NOTICE:  in object access: superuser finished create (subId=0x0) [internal]
 NOTICE:  in process utility: superuser finished CreateStmt
+CREATE INDEX regress_test_table_t_idx ON regress_test_table (t);
+NOTICE:  in process utility: superuser attempting IndexStmt
+NOTICE:  in object access: superuser attempting create (subId=0x0) [explicit]
+NOTICE:  in object access: superuser finished create (subId=0x0) [explicit]
+NOTICE:  in process utility: superuser finished IndexStmt
 GRANT SELECT ON Table regress_test_table TO public;
 NOTICE:  in process utility: superuser attempting GrantStmt
 NOTICE:  in process utility: superuser finished GrantStmt
@@ -280,12 +285,18 @@ NOTICE:  in process utility: superuser attempting alter system
 NOTICE:  in object_access_hook_str: superuser attempting alter (subId=0x2000, alter system) [work_mem]
 NOTICE:  in object_access_hook_str: superuser finished alter (subId=0x2000, alter system) [work_mem]
 NOTICE:  in process utility: superuser finished alter system
--- Clean up
+-- try labelled drops
 RESET SESSION AUTHORIZATION;
 NOTICE:  in process utility: superuser attempting set
 NOTICE:  in object_access_hook_str: superuser attempting alter (subId=0x1000, set) [session_authorization]
 NOTICE:  in object_access_hook_str: superuser finished alter (subId=0x1000, set) [session_authorization]
 NOTICE:  in process utility: superuser finished set
+DROP INDEX CONCURRENTLY regress_test_table_t_idx;
+NOTICE:  in process utility: superuser attempting DropStmt
+NOTICE:  in object access: superuser attempting drop (subId=0x0) [concurrent drop,]
+NOTICE:  in object access: superuser finished drop (subId=0x0) [concurrent drop,]
+NOTICE:  in process utility: superuser finished DropStmt
+-- Clean up
 SET test_oat_hooks.audit = false;
 NOTICE:  in process utility: superuser attempting set
 DROP ROLE regress_role_joe;  -- fails
index d692f52d922b07fa51bcdc8de0a632e66f69c6d1..d0cca8c44eb9bf5d2e79ba68a363f14148d1bd5e 100644 (file)
@@ -38,6 +38,7 @@ REVOKE ALL ON PARAMETER "none.such" FROM PUBLIC;
 -- Create objects for use in the test
 CREATE USER regress_test_user;
 CREATE TABLE regress_test_table (t text);
+CREATE INDEX regress_test_table_t_idx ON regress_test_table (t);
 GRANT SELECT ON Table regress_test_table TO public;
 CREATE FUNCTION regress_test_func (t text) RETURNS text AS $$
    SELECT $1;
@@ -88,9 +89,11 @@ RESET work_mem;
 ALTER SYSTEM SET work_mem = 8192;
 ALTER SYSTEM RESET work_mem;
 
--- Clean up
+-- try labelled drops
 RESET SESSION AUTHORIZATION;
+DROP INDEX CONCURRENTLY regress_test_table_t_idx;
 
+-- Clean up
 SET test_oat_hooks.audit = false;
 DROP ROLE regress_role_joe;  -- fails
 REVOKE ALL PRIVILEGES ON PARAMETER
index 1f40d632e07970d1f0d3d375196bef3f97fbecac..900d597f5ddca896ee512a481bbd38be62c5a794 100644 (file)
@@ -1795,15 +1795,15 @@ accesstype_arg_to_string(ObjectAccessType access, void *arg)
                return psprintf("%s%s%s%s%s%s",
                                ((drop_arg->dropflags & PERFORM_DELETION_INTERNAL)
                                 ? "internal action," : ""),
-                               ((drop_arg->dropflags & PERFORM_DELETION_INTERNAL)
+                               ((drop_arg->dropflags & PERFORM_DELETION_CONCURRENTLY)
                                 ? "concurrent drop," : ""),
-                               ((drop_arg->dropflags & PERFORM_DELETION_INTERNAL)
+                               ((drop_arg->dropflags & PERFORM_DELETION_QUIETLY)
                                 ? "suppress notices," : ""),
-                               ((drop_arg->dropflags & PERFORM_DELETION_INTERNAL)
+                               ((drop_arg->dropflags & PERFORM_DELETION_SKIP_ORIGINAL)
                                 ? "keep original object," : ""),
-                               ((drop_arg->dropflags & PERFORM_DELETION_INTERNAL)
+                               ((drop_arg->dropflags & PERFORM_DELETION_SKIP_EXTENSIONS)
                                 ? "keep extensions," : ""),
-                               ((drop_arg->dropflags & PERFORM_DELETION_INTERNAL)
+                               ((drop_arg->dropflags & PERFORM_DELETION_CONCURRENT_LOCK)
                                 ? "normal concurrent drop," : ""));
            }
            break;