From f7a2002e82cfc639d1b6df89012f5d6c623ad545 Mon Sep 17 00:00:00 2001 From: Joe Conway Date: Sat, 23 Nov 2019 10:39:20 -0500 Subject: Add object TRUNCATE hook All operations with acl permissions checks should have a corresponding hook so that, for example, mandatory access control (MAC) may be enforced by an extension. The command TRUNCATE is missing this hook, so add it. Patch by Yuli Khodorkovskiy with some editorialization by me. Based on the discussion not back-patched. A separate patch will exercise the hook in the sepgsql extension. Author: Yuli Khodorkovskiy Reviewed-by: Joe Conway Discussion: https://postgr.es/m/CAFL5wJcomybj1Xdw7qWmPJRpGuFukKgNrDb6uVBaCMgYS9dkaA%40mail.gmail.com --- src/backend/commands/tablecmds.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/backend/commands/tablecmds.c') diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 45aae5955d0..5440eb90153 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -1937,6 +1937,8 @@ truncate_check_rel(Oid relid, Form_pg_class reltuple) (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("permission denied: \"%s\" is a system catalog", relname))); + + InvokeObjectTruncateHook(relid); } /* -- cgit v1.2.3