Project

General

Profile

« Previous | Next » 

Revision 5653

schemas/vegbien.sql: taxonlabel_2_propagate_canon_label_id(): If no matched taxonlabel, make self-reference. This fixes a bug in analytical_db_view where rows without a canon_label_id were excluded because they did not have a corresponding canonical taxonlabel.

View differences:

schemas/vegbien.sql
490 490
BEGIN
491 491
    IF new.matched_label_id IS NOT NULL THEN
492 492
        IF new.matched_label_id = new.taxonlabel_id THEN -- self-reference
493
            new.canon_label_id = new.taxonlabel_id;-- make self-reference
493
            new.canon_label_id = new.taxonlabel_id; -- make self-reference
494 494
        ELSE -- propagate from matched label
495 495
            new.canon_label_id = (
496 496
                SELECT canon_label_id
......
505 505
        WHERE matched_label_id = new.taxonlabel_id
506 506
        AND taxonlabel_id != new.taxonlabel_id -- avoid infinite recursion
507 507
        ;
508
    ELSE -- no matched taxonlabel
509
        new.canon_label_id = new.taxonlabel_id; -- make self-reference
508 510
    END IF;
509 511
    RETURN new;
510 512
END;

Also available in: Unified diff