Project

General

Profile

« Previous | Next » 

Revision 6794

schemas/vegbien.sql: sourcename: Added sourcename_set_matched_source_id() trigger

View differences:

vegbien.sql
899 899

  
900 900

  
901 901
--
902
-- Name: sourcename_set_matched_source_id(); Type: FUNCTION; Schema: public; Owner: -
903
--
904

  
905
CREATE FUNCTION sourcename_set_matched_source_id() RETURNS trigger
906
    LANGUAGE plpgsql
907
    AS $$
908
BEGIN
909
    IF new.matched_source_id IS NULL THEN -- populate matched_source_id
910
        new.matched_source_id :=
911
            (SELECT source_id FROM source WHERE shortname = new.name);
912
    END IF;
913
    RETURN new;
914
END;
915
$$;
916

  
917

  
918
--
902 919
-- Name: sync_analytical_aggregate_to_view(); Type: FUNCTION; Schema: public; Owner: -
903 920
--
904 921

  
......
6507 6524

  
6508 6525

  
6509 6526
--
6527
-- Name: sourcename_set_matched_source_id; Type: TRIGGER; Schema: public; Owner: -
6528
--
6529

  
6530
CREATE TRIGGER sourcename_set_matched_source_id BEFORE INSERT OR UPDATE ON sourcename FOR EACH ROW EXECUTE PROCEDURE sourcename_set_matched_source_id();
6531

  
6532

  
6533
--
6510 6534
-- Name: taxondetermination_set_iscurrent; Type: TRIGGER; Schema: public; Owner: -
6511 6535
--
6512 6536

  

Also available in: Unified diff