Project

General

Profile

« Previous | Next » 

Revision 5970

schemas/vegbien.sql: taxonlabel_set_canon_label_id(): Fixed bug where always need to set canon_label_id on insert (because it must be a self-reference rather than NULL if there is no matched_label_id), but wasn't being set when no matched_label_id because the IS DISTINCT FROM check returned false

View differences:

schemas/vegbien.sql
813 813
    LANGUAGE plpgsql
814 814
    AS $$
815 815
BEGIN
816
    IF new.matched_label_id IS DISTINCT FROM old_matched_label_id THEN
816
    IF NOT is_update
817
        OR new.matched_label_id IS DISTINCT FROM old_matched_label_id THEN
817 818
        IF new.matched_label_id IS NOT NULL THEN
818 819
            IF new.matched_label_id = new.taxonlabel_id THEN -- self-reference
819 820
                new.canon_label_id := new.taxonlabel_id; -- make self-reference

Also available in: Unified diff