action_trigger.event

Deferrable Constraints: The following FK constraints are deferrable — they are checked at transaction end, not statement end: event_event_def_fkey.

Columns

Column Type Nullable Default Notes

id PK

bigint

No

nextval('action_trigger.event_id_seq'::regclass)

target

bigint

No

event_def FK

integer

Yes

action_trigger.event_definition(id)

add_time

timestamp with time zone

No

now()

run_time

timestamp with time zone

No

start_time

timestamp with time zone

Yes

update_time

timestamp with time zone

Yes

complete_time

timestamp with time zone

Yes

update_process

integer

Yes

state

text

No

'pending'::text

user_data

text

Yes

template_output FK

bigint

Yes

action_trigger.event_output(id)

error_output FK

bigint

Yes

action_trigger.event_output(id)

async_output FK

bigint

Yes

action_trigger.event_output(id)

context_user FK

integer

Yes

actor.usr(id)

context_library FK

integer

Yes

actor.org_unit(id)

context_bib FK

bigint

Yes

biblio.record_entry(id)

context_item

bigint

Yes

Primary Key

(id)

Foreign Keys

Column(s) References On Delete On Update Deferrable Constraint

async_output

action_trigger.event_output(id)

NO ACTION

NO ACTION

No

event_async_output_fkey

context_bib

biblio.record_entry(id)

NO ACTION

NO ACTION

No

event_context_bib_fkey

context_library

actor.org_unit(id)

NO ACTION

NO ACTION

No

event_context_library_fkey

context_user

actor.usr(id)

NO ACTION

NO ACTION

No

event_context_user_fkey

error_output

action_trigger.event_output(id)

NO ACTION

NO ACTION

No

event_error_output_fkey

event_def

action_trigger.event_definition(id)

NO ACTION

NO ACTION

DEFERRED

event_event_def_fkey

template_output

action_trigger.event_output(id)

NO ACTION

NO ACTION

No

event_template_output_fkey

Check Constraints

  • event_state_check: CHECK state = ANY (ARRAY['pending'::text, 'invalid'::text, 'found'::text, 'collecting'::text, 'collected'::text, 'validating'::text, 'valid'::text, 'reacting'::text, 'reacted'::text, 'cleaning'::text, 'complete'::text, 'error'::text])

  • event_user_data_check: CHECK

Indexes

Index Method Definition

event_pkey PK

btree

CREATE UNIQUE INDEX event_pkey ON action_trigger.event USING btree (id)

atev_async_output

btree

CREATE INDEX atev_async_output ON action_trigger.event USING btree (async_output)

atev_context_item

btree

CREATE INDEX atev_context_item ON action_trigger.event USING btree (context_item)

atev_context_library

btree

CREATE INDEX atev_context_library ON action_trigger.event USING btree (context_library)

atev_context_user

btree

CREATE INDEX atev_context_user ON action_trigger.event USING btree (context_user)

atev_def_state

btree

CREATE INDEX atev_def_state ON action_trigger.event USING btree (event_def, state)

atev_error_output

btree

CREATE INDEX atev_error_output ON action_trigger.event USING btree (error_output)

atev_target_def_idx

btree

CREATE INDEX atev_target_def_idx ON action_trigger.event USING btree (target, event_def)

atev_template_output

btree

CREATE INDEX atev_template_output ON action_trigger.event USING btree (template_output)

Triggers

Trigger Timing Event Level Function

action_trigger_event_context_item_fkey_trig

AFTER

INSERT OR UPDATE

ROW

evergreen.fake_fkey_tgr()

Trigger Bodies

action_trigger_event_context_item_fkey_trig

Function: evergreen.fake_fkey_tgr()
Timing: AFTER INSERT OR UPDATE ROW

DECLARE
    copy_id BIGINT;
BEGIN
    EXECUTE 'SELECT ($1).' || quote_ident(TG_ARGV[0]) INTO copy_id USING NEW;
    IF copy_id IS NOT NULL THEN
        PERFORM * FROM asset.copy WHERE id = copy_id;
        IF NOT FOUND THEN
            RAISE EXCEPTION 'Key (%.%=%) does not exist in asset.copy', TG_TABLE_SCHEMA, TG_TABLE_NAME, copy_id;
        END IF;
    END IF;
    RETURN NULL;
END;