action.hold_request
|
Deferrable Constraints: The following FK constraints are deferrable — they are checked at transaction end, not statement end: |
|
Trigger Side Effects: Writing to this table automatically triggers writes to other tables:
|
Columns
| Column | Type | Nullable | Default | Notes |
|---|---|---|---|---|
id PK |
|
No |
nextval('action.hold_request_id_seq'::regclass) |
|
request_time |
|
No |
now() |
|
capture_time |
|
Yes |
||
fulfillment_time |
|
Yes |
||
checkin_time |
|
Yes |
||
return_time |
|
Yes |
||
prev_check_time |
|
Yes |
||
expire_time |
|
Yes |
||
cancel_time |
|
Yes |
||
cancel_cause FK |
|
Yes |
||
cancel_note |
|
Yes |
||
canceled_by FK |
|
Yes |
||
canceling_ws FK |
|
Yes |
||
target |
|
No |
||
current_copy |
|
Yes |
||
fulfillment_staff FK |
|
Yes |
||
fulfillment_lib FK |
|
Yes |
||
request_lib FK |
|
No |
||
requestor FK |
|
No |
||
usr FK |
|
No |
||
selection_ou FK |
|
No |
||
selection_depth |
|
No |
0 |
|
pickup_lib FK |
|
No |
||
hold_type FK |
|
Yes |
||
holdable_formats |
|
Yes |
||
phone_notify |
|
Yes |
||
email_notify |
|
No |
false |
|
sms_notify |
|
Yes |
||
sms_carrier FK |
|
Yes |
||
frozen |
|
No |
false |
|
thaw_date |
|
Yes |
||
shelf_time |
|
Yes |
||
cut_in_line |
|
Yes |
||
mint_condition |
|
No |
true |
|
shelf_expire_time |
|
Yes |
||
current_shelf_lib FK |
|
Yes |
||
behind_desk |
|
No |
false |
|
hopeless_date |
|
Yes |
||
acq_request FK |
|
Yes |
Foreign Keys
| Column(s) | References | On Delete | On Update | Deferrable | Constraint |
|---|---|---|---|---|---|
|
NO ACTION |
NO ACTION |
No |
|
|
|
SET NULL |
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 |
|
|
|
NO ACTION |
NO ACTION |
DEFERRED |
|
|
|
NO ACTION |
NO ACTION |
DEFERRED |
|
|
|
NO ACTION |
NO ACTION |
DEFERRED |
|
|
|
NO ACTION |
NO ACTION |
DEFERRED |
|
|
|
NO ACTION |
NO ACTION |
No |
|
|
|
NO ACTION |
NO ACTION |
DEFERRED |
|
Indexes
| Index | Method | Definition |
|---|---|---|
|
btree |
|
|
btree |
|
|
btree |
|
|
btree |
|
|
btree |
|
|
btree |
|
|
btree |
|
|
btree |
|
|
btree |
|
|
btree |
|
|
btree |
|
|
btree |
|
|
btree |
|
|
btree |
|
|
btree |
|
|
btree |
|
Triggers
| Trigger | Timing | Event | Level | Function |
|---|---|---|---|---|
|
BEFORE |
DELETE |
ROW |
|
|
AFTER |
UPDATE |
ROW |
|
|
AFTER |
INSERT OR UPDATE |
ROW |
Trigger Bodies
action_hold_request_aging_tgr
Function: action.age_hold_on_delete()
Timing: BEFORE DELETE ROW
DECLARE
BEGIN
-- Archive a copy of the old row to action.aged_hold_request
INSERT INTO action.aged_hold_request
(usr_post_code,
usr_home_ou,
usr_profile,
usr_birth_year,
staff_placed,
id,
request_time,
capture_time,
fulfillment_time,
checkin_time,
return_time,
prev_check_time,
expire_time,
cancel_time,
cancel_cause,
cancel_note,
target,
current_copy,
fulfillment_staff,
fulfillment_lib,
request_lib,
selection_ou,
selection_depth,
pickup_lib,
hold_type,
holdable_formats,
phone_notify,
email_notify,
sms_notify,
frozen,
thaw_date,
shelf_time,
cut_in_line,
mint_condition,
shelf_expire_time,
current_shelf_lib,
behind_desk)
SELECT
usr_post_code,
usr_home_ou,
usr_profile,
usr_birth_year,
staff_placed,
id,
request_time,
capture_time,
fulfillment_time,
checkin_time,
return_time,
prev_check_time,
expire_time,
cancel_time,
cancel_cause,
cancel_note,
target,
current_copy,
fulfillment_staff,
fulfillment_lib,
request_lib,
selection_ou,
selection_depth,
pickup_lib,
hold_type,
holdable_formats,
phone_notify,
email_notify,
sms_notify,
frozen,
thaw_date,
shelf_time,
cut_in_line,
mint_condition,
shelf_expire_time,
current_shelf_lib,
behind_desk
FROM action.all_hold_request WHERE id = OLD.id;
RETURN OLD;
END;
hold_request_clear_map_tgr
Function: action.hold_request_clear_map()
Timing: AFTER UPDATE ROW
BEGIN
DELETE FROM action.hold_copy_map WHERE hold = NEW.id;
RETURN NEW;
END;
reporter_hold_request_record_trigger
Function: reporter.hold_request_record_mapper()
Timing: AFTER INSERT OR UPDATE ROW
BEGIN
IF TG_OP = 'INSERT' THEN
INSERT INTO reporter.hold_request_record (id, target, hold_type, bib_record)
SELECT NEW.id,
NEW.target,
NEW.hold_type,
CASE
WHEN NEW.hold_type = 'T'
THEN NEW.target
WHEN NEW.hold_type = 'I'
THEN (SELECT ssub.record_entry FROM serial.subscription ssub JOIN serial.issuance si ON (si.subscription = ssub.id) WHERE si.id = NEW.target)
WHEN NEW.hold_type = 'V'
THEN (SELECT cn.record FROM asset.call_number cn WHERE cn.id = NEW.target)
WHEN NEW.hold_type IN ('C','R','F')
THEN (SELECT cn.record FROM asset.call_number cn JOIN asset.copy cp ON (cn.id = cp.call_number) WHERE cp.id = NEW.target)
WHEN NEW.hold_type = 'M'
THEN (SELECT mr.master_record FROM metabib.metarecord mr WHERE mr.id = NEW.target)
WHEN NEW.hold_type = 'P'
THEN (SELECT bmp.record FROM biblio.monograph_part bmp WHERE bmp.id = NEW.target)
END AS bib_record;
ELSIF TG_OP = 'UPDATE' AND (OLD.target <> NEW.target OR OLD.hold_type <> NEW.hold_type) THEN
UPDATE reporter.hold_request_record
SET target = NEW.target,
hold_type = NEW.hold_type,
bib_record = CASE
WHEN NEW.hold_type = 'T'
THEN NEW.target
WHEN NEW.hold_type = 'I'
THEN (SELECT ssub.record_entry FROM serial.subscription ssub JOIN serial.issuance si ON (si.subscription = ssub.id) WHERE si.id = NEW.target)
WHEN NEW.hold_type = 'V'
THEN (SELECT cn.record FROM asset.call_number cn WHERE cn.id = NEW.target)
WHEN NEW.hold_type IN ('C','R','F')
THEN (SELECT cn.record FROM asset.call_number cn JOIN asset.copy cp ON (cn.id = cp.call_number) WHERE cp.id = NEW.target)
WHEN NEW.hold_type = 'M'
THEN (SELECT mr.master_record FROM metabib.metarecord mr WHERE mr.id = NEW.target)
WHEN NEW.hold_type = 'P'
THEN (SELECT bmp.record FROM biblio.monograph_part bmp WHERE bmp.id = NEW.target)
END
WHERE id = NEW.id;
END IF;
RETURN NEW;
END;
Referenced By
The following tables have foreign keys pointing to action.hold_request (7 referencing table(s)):
| Table | Referencing Column(s) | Referenced Column(s) | Constraint |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|