Tidy up Object Access hooks tests
authorAndrew Dunstan <andrew@dunslane.net>
Tue, 22 Mar 2022 20:18:06 +0000 (16:18 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Tue, 22 Mar 2022 20:18:06 +0000 (16:18 -0400)
per gripelet from Tom Lane.

src/test/modules/test_oat_hooks/Makefile
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 d03ef2caf17f75aa76464be63b202dc9c0ca1adf..ba068acc5352fcf5d3cc16b8b0bfd7281e301ab7 100644 (file)
@@ -1,13 +1,10 @@
 # src/test/modules/test_oat_hooks/Makefile
 
 MODULE_big = test_oat_hooks
-OBJS = \
-   $(WIN32RES) \
-   test_oat_hooks.o
+OBJS = test_oat_hooks.o $(WIN32RES)
 PGFILEDESC = "test_oat_hooks - example use of object access hooks"
 
 REGRESS = test_oat_hooks
-NO_INSTALLCHECK = 1
 
 ifdef USE_PGXS
 PG_CONFIG = pg_config
index 4192a2fb49ec0e59f60e1dd65655416511db6a78..45ff276f7e93ec6aa70dc70b9636695dc3caef0f 100644 (file)
@@ -155,7 +155,7 @@ NOTICE:  in process utility: superuser attempting set
 NOTICE:  in object_access_hook_str: superuser attempting alter (set) [test_oat_hooks.deny_utility_commands]
 NOTICE:  in object_access_hook_str: superuser finished alter (set) [test_oat_hooks.deny_utility_commands]
 NOTICE:  in process utility: superuser finished set
--- Try again as non-superuser with permisisons denied
+-- Try again as non-superuser with permissions denied
 SET SESSION AUTHORIZATION regress_test_user;
 NOTICE:  in process utility: superuser attempting set
 NOTICE:  in object_access_hook_str: non-superuser attempting alter (set) [session_authorization]
index 7c3820278249926fb76f07b82b5ee2503cecb259..09e61864ee2d772f85d3c2250351ba20decaa54a 100644 (file)
@@ -39,7 +39,7 @@ SET test_oat_hooks.deny_object_access = true;
 SET test_oat_hooks.deny_exec_perms = true;
 SET test_oat_hooks.deny_utility_commands = true;
 
--- Try again as non-superuser with permisisons denied
+-- Try again as non-superuser with permissions denied
 SET SESSION AUTHORIZATION regress_test_user;
 SELECT * FROM regress_test_table;
 SELECT regress_test_func('arg');
index b50567749c448e64ac83a01bc032370874945b67..eb7564ce22e6371aa8134e547b721abfbb99e7d7 100644 (file)
@@ -192,6 +192,11 @@ _PG_fini(void)
 static void
 emit_audit_message(const char *type, const char *hook, char *action, char *objName)
 {
+   /*
+    * Ensure that audit messages are not duplicated by only emitting them from
+    * a leader process, not a worker process. This makes the test results
+    * deterministic even if run with force_parallel_mode = regress.
+    */
    if (REGRESS_audit && !IsParallelWorker())
    {
        const char *who = superuser_arg(GetUserId()) ? "superuser" : "non-superuser";