asset.copy_inventory
|
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('asset.copy_inventory_id_seq'::regclass) |
|
inventory_workstation FK |
|
Yes |
||
inventory_date |
|
No |
now() |
|
copy |
|
No |
Foreign Keys
| Column(s) | References | On Delete | On Update | Deferrable | Constraint |
|---|---|---|---|---|---|
|
NO ACTION |
NO ACTION |
DEFERRED |
|
Indexes
| Index | Method | Definition |
|---|---|---|
|
btree |
|
|
btree |
|
|
btree |
|
Triggers
| Trigger | Timing | Event | Level | Function |
|---|---|---|---|---|
|
AFTER |
INSERT OR UPDATE |
ROW |
|
|
AFTER |
INSERT OR UPDATE |
ROW |
Trigger Bodies
asset_copy_inventory_allowed_trig
Function: asset.copy_may_float_to_inventory_workstation()
Timing: AFTER INSERT OR UPDATE ROW
DECLARE
copy asset.copy%ROWTYPE;
workstation actor.workstation%ROWTYPE;
BEGIN
SELECT * INTO copy FROM asset.copy WHERE id = NEW.copy;
IF FOUND THEN
SELECT * INTO workstation FROM actor.workstation WHERE id = NEW.inventory_workstation;
IF FOUND THEN
IF copy.floating IS NULL THEN
IF copy.circ_lib <> workstation.owning_lib THEN
RAISE EXCEPTION 'Inventory workstation owning lib (%) does not match copy circ lib (%).',
workstation.owning_lib, copy.circ_lib;
END IF;
ELSE
IF NOT evergreen.can_float(copy.floating, copy.circ_lib, workstation.owning_lib) THEN
RAISE EXCEPTION 'Copy (%) cannot float to inventory workstation owning lib (%).',
copy.id, workstation.owning_lib;
END IF;
END IF;
END IF;
END IF;
RETURN NEW;
END;
inherit_asset_copy_inventory_copy_fkey
Function: evergreen.asset_copy_inventory_copy_inh_fkey()
Timing: AFTER INSERT OR UPDATE ROW
BEGIN
PERFORM 1 FROM asset.copy WHERE id = NEW.copy;
IF NOT FOUND THEN
RAISE foreign_key_violation USING MESSAGE = FORMAT(
$$Referenced asset.copy id not found, copy:%s$$, NEW.copy
);
END IF;
RETURN NEW;
END;