Remove unsafe thesaurus/control-set mapping user/miker/auth-control-set-safety
authorMike Rylander <mrylander@gmail.com>
Fri, 8 Jun 2012 13:26:25 +0000 (09:26 -0400)
committerMike Rylander <mrylander@gmail.com>
Fri, 8 Jun 2012 13:26:25 +0000 (09:26 -0400)
Evergreen 2.2 and beyond includes new Authority Control Set functionality intended to allow the definition of locally defined authority control headings.  The primary mechanism for determining which Control Set is used by any given authority record is to look at the thesaurus fixed field (mnemonic: Subj), which currently must be uniquely linked to a Control Set.  Failing that (in the case of no thesaurus code at all), there is a backup mechanism: if the thesaurus value for the authority record is missing or not used by any configured Control Set then Evergreen will look at the first Main Entry (1xx) field in the record, and find a control set which uses this field.  This is, obviously, not perfect, but for non-overlapping authority field schemes, it works very well.

However, the seed data for Evergreen currently includes the "no attempt to code" value of "|" in the set of thesauri that point to the LoC Control Set.  This value ("|") is also the default value for the Subj fixed field.  This means that the fallback mechanism is very likely never reached, and anything short of fully specifying an appropriate thesaurus code for any non-LoC authority record will run afoul of a similar outcome as the bib-data loss situation described in bug #983487.

We can avoid this situation in most cases by /not/ tying the "|" thesaurus value to the LoC control set.

This commit accomplishes this goal by allowing the Control Set for a thesaurus to be NULL, removing the Control Set for "|" and removing the Control Set recorded for records with "|" as the thesaurus value, thereby forcing Main Entry inspection on any use of the authority record where Control Set is required.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/sql/Pg/011.schema.authority.sql
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.data.safer-control-set-defaults.sql [new file with mode: 0644]

index 4f8fc74..1b15025 100644 (file)
@@ -47,7 +47,7 @@ CREATE TABLE authority.control_set_bib_field (
 
 CREATE TABLE authority.thesaurus (
     code        TEXT    PRIMARY KEY,     -- MARC21 thesaurus code
-    control_set INT     NOT NULL REFERENCES authority.control_set (id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+    control_set INT     REFERENCES authority.control_set (id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
     name        TEXT    NOT NULL UNIQUE, -- i18n
     description TEXT                     -- i18n
 );
index 4478d7a..5a3fd96 100644 (file)
@@ -10080,7 +10080,7 @@ INSERT INTO authority.thesaurus (code, name, control_set) VALUES
     ('s', oils_i18n_gettext('s','Sears List of Subject Headings','at','name'), 1),
     ('v', oils_i18n_gettext('v','Repertoire de vedettes-matiere','at','name'), 1),
     ('z', oils_i18n_gettext('z','Other','at','name'), 1),
-    ('|', oils_i18n_gettext('|','No attempt to code','at','name'), 1);
+    ('|', oils_i18n_gettext('|','No attempt to code','at','name'), NULL);
 
 INSERT INTO action_trigger.hook ( key, core_type, description, passive ) VALUES (
     'reservation.available',
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.safer-control-set-defaults.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.safer-control-set-defaults.sql
new file mode 100644 (file)
index 0000000..6404b38
--- /dev/null
@@ -0,0 +1,8 @@
+
+-- Allow un-mapped thesauri
+ALTER TABLE authority.thesaurus ALTER COLUMN control_set DROP NOT NULL;
+
+-- Don't tie "No attempt to code" to LoC
+UPDATE authority.thesaurus SET control_set = NULL WHERE code = '|';
+UPDATE authority.record_entry SET control_set = NULL WHERE id IN (SELECT record FROM authority.rec_descriptor WHERE thesaurus = '|');
+