action.hold_transit_copy

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

Columns

Column Type Nullable Default Notes

id PK

integer

No

nextval('action.transit_copy_id_seq'::regclass)

source_send_time

timestamp with time zone

Yes

dest_recv_time

timestamp with time zone

Yes

target_copy

bigint

No

source

integer

No

dest

integer

No

prev_hop

integer

Yes

copy_status

integer

No

persistant_transfer

boolean

No

false

prev_dest

integer

Yes

cancel_time

timestamp with time zone

Yes

hold FK

integer

Yes

action.hold_request(id)

Primary Key

(id)

Foreign Keys

Column(s) References On Delete On Update Deferrable Constraint

hold

action.hold_request(id)

SET NULL

NO ACTION

DEFERRED

hold_transit_copy_hold_fkey

Indexes

Index Method Definition

hold_transit_copy_pkey PK

btree

CREATE UNIQUE INDEX hold_transit_copy_pkey ON action.hold_transit_copy USING btree (id)

active_hold_transit_cp_idx

btree

CREATE INDEX active_hold_transit_cp_idx ON action.hold_transit_copy USING btree (target_copy)

active_hold_transit_dest_idx

btree

CREATE INDEX active_hold_transit_dest_idx ON action.hold_transit_copy USING btree (dest)

active_hold_transit_source_idx

btree

CREATE INDEX active_hold_transit_source_idx ON action.hold_transit_copy USING btree (source)

hold_transit_copy_hold_idx

btree

CREATE INDEX hold_transit_copy_hold_idx ON action.hold_transit_copy USING btree (hold)

Triggers

Trigger Timing Event Level Function

hold_transit_copy_is_unique_check

AFTER

INSERT

ROW

action.copy_transit_is_unique()

Trigger Bodies

hold_transit_copy_is_unique_check

Function: action.copy_transit_is_unique()
Timing: AFTER INSERT ROW

BEGIN
    PERFORM * FROM action.transit_copy
        WHERE target_copy = NEW.target_copy
              AND dest_recv_time IS NULL
              AND cancel_time IS NULL;

    IF FOUND THEN
        RAISE EXCEPTION 'Copy id=% is already in transit', NEW.target_copy;
    END IF;
    RETURN NULL;
END;