3 CREATE OR REPLACE FUNCTION evergreen.vandelay_import_item_imported_as_inh_fkey() RETURNS TRIGGER AS $f$
5 IF NEW.imported_as IS NULL THEN
8 PERFORM 1 FROM asset.copy WHERE id = NEW.imported_as;
10 RAISE foreign_key_violation USING MESSAGE = FORMAT(
11 $$Referenced asset.copy id not found, imported_as:%s$$, NEW.imported_as
16 $f$ LANGUAGE PLPGSQL VOLATILE COST 50;