actor.stat_cat
User Statistical Catagories
Local data collected about Users is placed into a Statistical Catagory. Here’s where those catagories are defined.
|
Data-Modifying Triggers: This table has BEFORE ROW trigger(s) that modify row data before write. Values you INSERT or UPDATE may differ from what is actually stored. See the Triggers section below. |
|
Cascading Deletes: Deleting rows from this table will cascade to: actor.org_unit. |
|
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('actor.stat_cat_id_seq'::regclass) |
|
owner FK |
|
No |
||
name |
|
No |
||
opac_visible |
|
No |
false |
|
usr_summary |
|
No |
false |
|
sip_field FK |
|
Yes |
||
sip_format |
|
Yes |
||
checkout_archive |
|
No |
false |
|
required |
|
No |
false |
|
allow_freetext |
|
No |
true |
Foreign Keys
| Column(s) | References | On Delete | On Update | Deferrable | Constraint |
|---|---|---|---|---|---|
|
CASCADE |
NO ACTION |
DEFERRED |
|
|
|
SET NULL |
CASCADE |
DEFERRED |
|
Indexes
| Index | Method | Definition |
|---|---|---|
|
btree |
|
|
btree |
|
Triggers
| Trigger | Timing | Event | Level | Function |
|---|---|---|---|---|
|
BEFORE |
INSERT OR UPDATE |
ROW |
Trigger Bodies
actor_stat_cat_sip_update_trigger
Function: actor.stat_cat_check()
Timing: BEFORE INSERT OR UPDATE ROW
|
This trigger modifies the row before it is written (returns a modified |
DECLARE
sipfield actor.stat_cat_sip_fields%ROWTYPE;
use_count INT;
BEGIN
IF NEW.sip_field IS NOT NULL THEN
SELECT INTO sipfield * FROM actor.stat_cat_sip_fields WHERE field = NEW.sip_field;
IF sipfield.one_only THEN
SELECT INTO use_count count(id) FROM actor.stat_cat WHERE sip_field = NEW.sip_field AND id != NEW.id;
IF use_count > 0 THEN
RAISE EXCEPTION 'Sip field cannot be used twice';
END IF;
END IF;
END IF;
RETURN NEW;
END;