fix thes to control set mapping
authorGalen Charlton <gmc@equinoxinitiative.org>
Fri, 18 Aug 2017 21:09:12 +0000 (21:09 +0000)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 18 Aug 2017 21:09:12 +0000 (21:09 +0000)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/sql/Pg/upgrade/YYYY.schema.thesauri.sql

index 53a9133..351044d 100644 (file)
@@ -460,7 +460,9 @@ $func$ LANGUAGE PLPGSQL STABLE STRICT;
 CREATE OR REPLACE FUNCTION authority.map_thesaurus_to_control_set () RETURNS TRIGGER AS $func$
 BEGIN
     IF NEW.control_set IS NULL THEN
-        SELECT  authority.extract_thesaurus(NEW.marc) INTO NEW.control_set;
+        SELECT control_set INTO NEW.control_set
+        FROM authority.thesaurus
+        WHERE code = authority.extract_thesaurus(NEW.marc);
     END IF;
 
     RETURN NEW;