action_trigger.event_definition
|
Data-Modifying Triggers: This table has BEFORE ROW trigger(s) that modify row data before write. Values you INSERT or UPDATE may differ from what is actually stored. See the Triggers section below. |
|
Deferrable Constraints: The following FK constraints are deferrable — they are checked at transaction end, not statement end: |
Columns
| Column | Type | Nullable | Default | Notes |
|---|---|---|---|---|
id PK |
|
No |
nextval('action_trigger.event_definition_id_seq'::regclass) |
|
active |
|
No |
true |
|
owner FK |
|
No |
||
name |
|
No |
||
hook FK |
|
No |
||
validator FK |
|
No |
||
reactor FK |
|
No |
||
cleanup_success FK |
|
Yes |
||
cleanup_failure FK |
|
Yes |
||
delay |
|
No |
'00:05:00'::interval |
|
max_delay |
|
Yes |
||
repeat_delay |
|
Yes |
||
usr_field |
|
Yes |
||
opt_in_setting FK |
|
Yes |
||
delay_field |
|
Yes |
||
group_field |
|
Yes |
||
template |
|
Yes |
||
granularity |
|
Yes |
||
context_usr_path |
|
Yes |
||
context_library_path |
|
Yes |
||
context_bib_path |
|
Yes |
||
context_item_path |
|
Yes |
||
message_template |
|
Yes |
||
message_usr_path |
|
Yes |
||
message_library_path |
|
Yes |
||
message_title |
|
Yes |
||
retention_interval |
|
Yes |
Foreign Keys
| Column(s) | References | On Delete | On Update | Deferrable | Constraint |
|---|---|---|---|---|---|
|
NO ACTION |
NO ACTION |
DEFERRED |
|
|
|
NO ACTION |
NO ACTION |
DEFERRED |
|
|
|
NO ACTION |
NO ACTION |
DEFERRED |
|
|
|
NO ACTION |
NO ACTION |
DEFERRED |
|
|
|
NO ACTION |
NO ACTION |
DEFERRED |
|
|
|
NO ACTION |
NO ACTION |
DEFERRED |
|
|
|
NO ACTION |
NO ACTION |
DEFERRED |
|
Unique Constraints
-
ev_def_name_owner_once:(owner, name) -
ev_def_owner_hook_val_react_clean_delay_once:(owner, hook, validator, reactor, delay, delay_field)
Indexes
| Index | Method | Definition |
|---|---|---|
|
btree |
|
|
btree |
|
|
btree |
|
Triggers
| Trigger | Timing | Event | Level | Function |
|---|---|---|---|---|
|
BEFORE |
INSERT OR UPDATE |
ROW |
Trigger Bodies
is_valid_retention_interval
Function: action_trigger.check_valid_retention_interval()
Timing: BEFORE INSERT OR UPDATE ROW
|
This trigger modifies the row before it is written (returns a modified |
BEGIN
/*
* 1. Retention intervals are always allowed on active hooks.
* 2. On passive hooks, retention intervals are only allowed
* when the event definition has a max_delay value and the
* retention_interval value is greater than the difference
* beteween the delay and max_delay values.
*/
PERFORM TRUE FROM action_trigger.hook
WHERE key = NEW.hook AND NOT passive;
IF FOUND THEN
RETURN NEW;
END IF;
IF NEW.max_delay IS NOT NULL THEN
IF EXTRACT(EPOCH FROM NEW.retention_interval) >
ABS(EXTRACT(EPOCH FROM (NEW.max_delay - NEW.delay))) THEN
RETURN NEW; -- all good
ELSE
RAISE EXCEPTION 'retention_interval is too short';
END IF;
ELSE
RAISE EXCEPTION 'retention_interval requires max_delay';
END IF;
END;
Referenced By
The following tables have foreign keys pointing to action_trigger.event_definition (5 referencing table(s)):
| Table | Referencing Column(s) | Referenced Column(s) | Constraint |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|