From f44f24b39128bb4cc84b715a0ba3fec02ce6d30f Mon Sep 17 00:00:00 2001 From: Stevan Earl Date: Mon, 6 Jul 2026 10:48:02 -0700 Subject: [PATCH] Backport groomings: validate initiator/terminator as event participants --- db/schemas/lib/triggers/create/groomings.m4 | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/db/schemas/lib/triggers/create/groomings.m4 b/db/schemas/lib/triggers/create/groomings.m4 index 80df96f..d8dc11b 100644 --- a/db/schemas/lib/triggers/create/groomings.m4 +++ b/db/schemas/lib/triggers/create/groomings.m4 @@ -120,7 +120,7 @@ CREATE OR REPLACE FUNCTION groomings_func () $$; -dnl Macro for checking Initiator and Terminator are actors or actees +dnl Macro for checking Initiator and Terminator are participants dnl in the grooming event. dnl (Because they are so similar.) dnl @@ -147,18 +147,14 @@ define({_sdb_grm_actor_or_actee}, (SELECT 1 FROM roles WHERE roles.eid = NEW.eid - AND roles.pid = NEW.$1 - AND (roles.role = 'sdb_actor' - OR roles.role = 'sdb_actee')); + AND roles.pid = NEW.$1); IF FOUND THEN RAISE EXCEPTION integrity_constraint_violation USING MESSAGE = 'Error on ' || TG_OP || ' of GROOMINGS' , DETAIL = 'Bad $1 value (' || textualize(NEW.$1) || '); $1 must be one of the participaints' - || ' in the grooming event and must either be the' - || ' one doing the grooming or the one receiving the' - || ' grooming' + || ' in the grooming event' || ': Key (EID = (' || NEW.eid || '): Value (Initiator) = (' -- 2.34.1