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