From 13caaac3ecaf6e33e412b71d5de182a13effca8c Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Fri, 19 Jan 2024 01:45:09 +0000 Subject: [PATCH] Fix minimum age of parent at time of birth calculation --- db/schemas/lib/triggers/create/biography.m4 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/db/schemas/lib/triggers/create/biography.m4 b/db/schemas/lib/triggers/create/biography.m4 index 61e80f5..7585cb9 100644 --- a/db/schemas/lib/triggers/create/biography.m4 +++ b/db/schemas/lib/triggers/create/biography.m4 @@ -248,13 +248,13 @@ CREATE OR REPLACE FUNCTION biography_func () WHERE (biography.sex = 'sdb_female' AND biography.animid = NEW.momid AND NEW.bdmax - > biography.bdmin - - 'sdb_min_f_birth sdb_min_f_birth_units'::interval) + < biography.bdmin + + 'sdb_min_f_birth sdb_min_f_birth_units'::interval) OR (biography.sex = 'sdb_male' AND biography.animid = NEW.dadid AND NEW.bdmax - > biography.bdmin - - 'sdb_min_m_birth sdb_min_m_birth_units'::interval); + < biography.bdmin + + 'sdb_min_m_birth sdb_min_m_birth_units'::interval); IF FOUND THEN RAISE EXCEPTION integrity_constraint_violation USING MESSAGE = 'An individual cannot have offspring when too young' -- 2.34.1