action.transit_copy

Deferrable Constraints: The following FK constraints are deferrable — they are checked at transaction end, not statement end: transit_copy_copy_status_fkey, transit_copy_dest_fkey, transit_copy_prev_dest_fkey, transit_copy_prev_hop_fkey, transit_copy_source_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 FK

integer

No

actor.org_unit(id)

dest FK

integer

No

actor.org_unit(id)

prev_hop FK

integer

Yes

action.transit_copy(id)

copy_status FK

integer

No

config.copy_status(id)

persistant_transfer

boolean

No

false

prev_dest FK

integer

Yes

actor.org_unit(id)

cancel_time

timestamp with time zone

Yes

Primary Key

(id)

Foreign Keys

Column(s) References On Delete On Update Deferrable Constraint

copy_status

config.copy_status(id)

NO ACTION

NO ACTION

DEFERRED

transit_copy_copy_status_fkey

dest

actor.org_unit(id)

NO ACTION

NO ACTION

DEFERRED

transit_copy_dest_fkey

prev_dest

actor.org_unit(id)

NO ACTION

NO ACTION

DEFERRED

transit_copy_prev_dest_fkey

prev_hop

action.transit_copy(id)

NO ACTION

NO ACTION

DEFERRED

transit_copy_prev_hop_fkey

source

actor.org_unit(id)

NO ACTION

NO ACTION

DEFERRED

transit_copy_source_fkey

Indexes

Index Method Definition

transit_copy_pkey PK

btree

CREATE UNIQUE INDEX transit_copy_pkey ON action.transit_copy USING btree (id)

active_transit_cp_idx

btree

CREATE INDEX active_transit_cp_idx ON action.transit_copy USING btree (target_copy)

active_transit_dest_idx

btree

CREATE INDEX active_transit_dest_idx ON action.transit_copy USING btree (dest)

active_transit_for_copy

btree

CREATE INDEX active_transit_for_copy ON action.transit_copy USING btree (target_copy) WHERE dest_recv_time IS NULL) AND (cancel_time IS NULL

active_transit_source_idx

btree

CREATE INDEX active_transit_source_idx ON action.transit_copy USING btree (source)

Triggers

Trigger Timing Event Level Function

transit_copy_is_unique_check

AFTER

INSERT

ROW

action.copy_transit_is_unique()

Trigger Bodies

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;

Referenced By

The following tables have foreign keys pointing to action.transit_copy (1 referencing table(s)):

Table Referencing Column(s) Referenced Column(s) Constraint

action.transit_copy

prev_hop

id

transit_copy_prev_hop_fkey