The bib attribute vector may be null, in the case of a record with no bib source
or LURI. When testing emptiness we need to ask if the field IS NULL rather than
just testing its contents.
Signed-off-by: Mike Rylander <miker@esilibrary.com>
if (!$pc_vis_test) { # staff search
$final_c_attr_test = '(' . $final_c_attr_test . " OR (" .
"NOT EXISTS (SELECT 1 FROM asset.copy_vis_attr_cache WHERE record = m.source) " .
- "AND NOT ( int3range(0,268435455,'[]') @> ANY(bre.vis_attr_vector) )".
+ "AND (bre.vis_attr_vector IS NULL OR NOT ( int4range(0,268435455,'[]') @> ANY(bre.vis_attr_vector) ))".
"))";
}
}
RETURN NEW;
ELSIF TG_OP = 'DELETE' THEN
DELETE FROM asset.copy_vis_attr_cache
- WHERE record = NEW.peer_record AND target_copy = NEW.target_copy;
+ WHERE record = OLD.peer_record AND target_copy = OLD.target_copy;
RETURN OLD;
END IF;