From 4d96474c8f085392c2c5dc21d0ba40a5a8e7c814 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 1 Sep 2017 17:22:42 -0400 Subject: [PATCH] LP#1152753: fix fake FK trigger on vandelay.import_item Fixes a regression caught by live_t/0824.item_import_defaults.pg Signed-off-by: Galen Charlton Signed-off-by: Mike Rylander --- Open-ILS/src/sql/Pg/800.fkeys.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Open-ILS/src/sql/Pg/800.fkeys.sql b/Open-ILS/src/sql/Pg/800.fkeys.sql index 8ae7d2647d..1ee6ead440 100644 --- a/Open-ILS/src/sql/Pg/800.fkeys.sql +++ b/Open-ILS/src/sql/Pg/800.fkeys.sql @@ -110,6 +110,9 @@ ALTER TABLE serial.unit ADD CONSTRAINT serial_unit_editor_fkey FOREIGN KEY (edit CREATE OR REPLACE FUNCTION evergreen.vandelay_import_item_imported_as_inh_fkey() RETURNS TRIGGER AS $f$ BEGIN + IF NEW.imported_as IS NULL THEN + RETURN NEW; + END IF; PERFORM 1 FROM asset.copy WHERE id = NEW.imported_as; IF NOT FOUND THEN RAISE foreign_key_violation USING MESSAGE = FORMAT( -- 2.11.0