diff --git a/openbis/source/sql/postgresql/186/function-186.sql b/openbis/source/sql/postgresql/186/function-186.sql index 58c307ec4bee3ed9a2e3451a4550b4287a7af072..67a6316be8af3db4abccffe5475513ab531e4a74 100644 --- a/openbis/source/sql/postgresql/186/function-186.sql +++ b/openbis/source/sql/postgresql/186/function-186.sql @@ -3346,7 +3346,7 @@ DECLARE proj_code VARCHAR; container_code VARCHAR; identifier VARCHAR := '/'; BEGIN - IF NEW IS DISTINCT FROM NULL AND (OLD IS NOT DISTINCT FROM NULL OR + IF TG_OP != 'DELETE' AND (TG_OP = 'INSERT' OR (NEW.space_id IS DISTINCT FROM OLD.space_id OR NEW.proj_id IS DISTINCT FROM OLD.proj_id OR NEW.samp_id_part_of IS DISTINCT FROM OLD.samp_id_part_of)) THEN IF NEW.space_id IS NOT NULL THEN diff --git a/openbis/source/sql/postgresql/migration/migration-185-186.sql b/openbis/source/sql/postgresql/migration/migration-185-186.sql index dab408011ce75c681840c2020a90769c33713144..c3f4819d153aa93a0b0f171f0bf103d27f502209 100644 --- a/openbis/source/sql/postgresql/migration/migration-185-186.sql +++ b/openbis/source/sql/postgresql/migration/migration-185-186.sql @@ -42,7 +42,7 @@ DECLARE proj_code VARCHAR; container_code VARCHAR; identifier VARCHAR := '/'; BEGIN - IF NEW IS DISTINCT FROM NULL AND (OLD IS NOT DISTINCT FROM NULL OR + IF TG_OP != 'DELETE' AND (TG_OP = 'INSERT' OR (NEW.space_id IS DISTINCT FROM OLD.space_id OR NEW.proj_id IS DISTINCT FROM OLD.proj_id OR NEW.samp_id_part_of IS DISTINCT FROM OLD.samp_id_part_of)) THEN IF NEW.space_id IS NOT NULL THEN diff --git a/openbis/sourceTest/sql/postgresql/186/schema-186.sql b/openbis/sourceTest/sql/postgresql/186/schema-186.sql index 662d89801bc9e6b1cebe16212e819a3f400bd343..8f4959b254d617e20a6faf4128016465829139c1 100644 --- a/openbis/sourceTest/sql/postgresql/186/schema-186.sql +++ b/openbis/sourceTest/sql/postgresql/186/schema-186.sql @@ -909,7 +909,7 @@ DECLARE proj_code VARCHAR; container_code VARCHAR; identifier VARCHAR := '/'; BEGIN - IF NEW IS DISTINCT FROM NULL AND (OLD IS NOT DISTINCT FROM NULL OR + IF TG_OP != 'DELETE' AND (TG_OP = 'INSERT' OR (NEW.space_id IS DISTINCT FROM OLD.space_id OR NEW.proj_id IS DISTINCT FROM OLD.proj_id OR NEW.samp_id_part_of IS DISTINCT FROM OLD.samp_id_part_of)) THEN IF NEW.space_id IS NOT NULL THEN