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
This commit is contained in:
Alvaro Herrera 2022-07-13 11:57:25 +02:00
parent 784cedda06
commit f16180216d
No known key found for this signature in database
GPG Key ID: 1C20ACB9D5C564AE
3 changed files with 21 additions and 7 deletions

View 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

View 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

View 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;