Sha256: cc499c31998f778e5cabd2e3a84f35f99522f8f01d393762ae25b363e65d8314
Contents?: true
Size: 562 Bytes
Versions: 15
Compression:
Stored size: 562 Bytes
Contents
CREATE OR REPLACE FUNCTION update_pathology_observations_nresult_from_trigger() RETURNS TRIGGER AS $body$ DECLARE BEGIN IF (TG_OP = 'INSERT' OR TG_OP = 'UPDATE') THEN NEW.nresult = convert_to_float(NEW.result, NULL); END IF; RETURN NEW ; END $body$ LANGUAGE plpgsql; COMMENT ON FUNCTION update_pathology_observations_nresult_from_trigger() IS 'Tries to coerce the result column into the nresult column as a float. Sets nresult to NULL if result is eg text and cannot be coerced. nresult is a performance optimisation useful for instance in graphing';
Version data entries
15 entries across 15 versions & 1 rubygems